2021-12-21 15:15:45 +00:00
|
|
|
{
|
|
|
|
description = "Moxxy v2";
|
|
|
|
inputs = {
|
2023-07-21 17:24:10 +00:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2021-12-21 15:15:45 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-07-21 17:24:10 +00:00
|
|
|
android-nixpkgs.url = "github:tadfisher/android-nixpkgs";
|
2023-07-25 20:09:13 +00:00
|
|
|
bab.url = "git+https://codeberg.org/PapaTutuWawa/bits-and-bytes.git";
|
2021-12-21 15:15:45 +00:00
|
|
|
};
|
|
|
|
|
2023-07-25 20:09:13 +00:00
|
|
|
outputs = { self, nixpkgs, flake-utils, android-nixpkgs, bab }: flake-utils.lib.eachDefaultSystem (system: let
|
2021-12-21 15:15:45 +00:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2022-07-30 15:24:13 +00:00
|
|
|
config = {
|
|
|
|
android_sdk.accept_license = true;
|
|
|
|
allowUnfree = true;
|
2023-07-21 17:24:10 +00:00
|
|
|
|
|
|
|
# Fix to allow building the NDK package
|
|
|
|
# TODO: Remove once https://github.com/tadfisher/android-nixpkgs/issues/62 is resolved
|
|
|
|
permittedInsecurePackages = [
|
|
|
|
"python-2.7.18.6"
|
|
|
|
];
|
2022-07-30 15:24:13 +00:00
|
|
|
};
|
2021-12-21 15:15:45 +00:00
|
|
|
};
|
2023-07-21 17:24:10 +00:00
|
|
|
# Everything to make Flutter happy
|
|
|
|
sdk = android-nixpkgs.sdk.${system} (sdkPkgs: with sdkPkgs; [
|
|
|
|
cmdline-tools-latest
|
|
|
|
build-tools-30-0-3
|
|
|
|
build-tools-33-0-2
|
|
|
|
build-tools-34-0-0
|
|
|
|
platform-tools
|
|
|
|
emulator
|
|
|
|
patcher-v4
|
|
|
|
platforms-android-28
|
|
|
|
platforms-android-29
|
|
|
|
platforms-android-30
|
|
|
|
platforms-android-31
|
|
|
|
platforms-android-33
|
|
|
|
|
|
|
|
# For flutter_zxing
|
|
|
|
cmake-3-18-1
|
|
|
|
#ndk-21-4-7075529
|
|
|
|
(ndk-21-4-7075529.overrideAttrs (old: {
|
|
|
|
buildInputs = old.buildInputs ++ [ pkgs.python27 ];
|
|
|
|
}))
|
|
|
|
]);
|
2023-07-25 20:09:13 +00:00
|
|
|
lib = pkgs.lib;
|
|
|
|
babPkgs = bab.packages."${system}";
|
2023-03-01 12:29:20 +00:00
|
|
|
pinnedJDK = pkgs.jdk17;
|
2021-12-27 12:02:59 +00:00
|
|
|
|
|
|
|
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
2022-02-17 12:03:33 +00:00
|
|
|
requests pyyaml # For the build scripts
|
|
|
|
pycryptodome # For the Monal UDP Logger
|
2021-12-27 12:02:59 +00:00
|
|
|
]);
|
2021-12-21 15:15:45 +00:00
|
|
|
in {
|
|
|
|
devShell = pkgs.mkShell {
|
2022-04-15 10:46:08 +00:00
|
|
|
buildInputs = with pkgs; [
|
2023-07-21 17:24:10 +00:00
|
|
|
# Android
|
|
|
|
pinnedJDK sdk
|
|
|
|
scrcpy
|
|
|
|
|
|
|
|
# Flutter
|
|
|
|
flutter37
|
|
|
|
|
|
|
|
# Build scripts
|
|
|
|
pythonEnv gnumake
|
|
|
|
|
|
|
|
# Code hygiene
|
|
|
|
gitlint jq
|
2021-12-21 15:15:45 +00:00
|
|
|
];
|
|
|
|
|
2023-07-21 17:24:10 +00:00
|
|
|
ANDROID_SDK_ROOT = "${sdk}/share/android-sdk";
|
|
|
|
ANDROID_HOME = "${sdk}/share/android-sdk";
|
2021-12-21 15:15:45 +00:00
|
|
|
JAVA_HOME = pinnedJDK;
|
2023-07-21 17:24:10 +00:00
|
|
|
|
|
|
|
# Fix an issue with Flutter using an older version of aapt2, which does not know
|
|
|
|
# an used parameter.
|
|
|
|
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${sdk}/share/android-sdk/build-tools/34.0.0/aapt2";
|
2021-12-21 15:15:45 +00:00
|
|
|
};
|
2023-07-25 20:09:13 +00:00
|
|
|
|
|
|
|
apps = let
|
|
|
|
providerArg = pkgs.writeText "provider-arg.cfg" ''
|
|
|
|
name = OpenSC-PKCS11
|
|
|
|
description = SunPKCS11 via OpenSC
|
|
|
|
library = ${pkgs.opensc}/lib/opensc-pkcs11.so
|
|
|
|
slotListIndex = 0
|
|
|
|
'';
|
|
|
|
mkBuildScript = skipBuild: pkgs.writeShellScript "build-anitrack.sh" ''
|
|
|
|
${babPkgs.flutter-build}/bin/flutter-build \
|
|
|
|
--name Moxxy \
|
|
|
|
--not-signed \
|
|
|
|
--zipalign ${sdk}/share/android-sdk/build-tools/34.0.0/zipalign \
|
|
|
|
--apksigner ${sdk}/share/android-sdk/build-tools/34.0.0/apksigner \
|
|
|
|
--provider-config ${providerArg} ${lib.optional skipBuild "--skip-build"}
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
# Skip the build and just sign
|
|
|
|
onlySign = {
|
|
|
|
type = "app";
|
|
|
|
program = "${mkBuildScript true}";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Build everything and sign
|
|
|
|
build = {
|
|
|
|
type = "app";
|
|
|
|
program = "${mkBuildScript false}";
|
|
|
|
};
|
|
|
|
};
|
2021-12-21 15:15:45 +00:00
|
|
|
});
|
|
|
|
}
|