0
0
Fork 0
nix-flutter-android-template/flake.nix

47 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-11-13 18:26:27 +01:00
{
inputs.nixpkgs.url = "nixpkgs/nixos-24.05";
outputs = { self, nixpkgs }: let
inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
"armv7l-linux"
];
forAllSystems = f: lib.genAttrs systems (system: let
pkgs = import nixpkgs {
inherit system;
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
androidSdk = (pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = [ "34.0.0" "30.0.3" ];
platformVersions = [ "34" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
includeEmulator = true;
cmdLineToolsVersion = "13.0";
}).androidsdk;
in f system pkgs androidSdk);
in {
devShells = forAllSystems (_: pkgs: androidSdk: {
default = let
jdk = pkgs.jdk17;
in pkgs.mkShell {
env = {
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
JAVA_HOME = "${jdk}/lib/openjdk";
};
packages = [
pkgs.flutter
androidSdk
jdk
];
};
});
};
}