Created
May 10, 2024 08:47
-
-
Save dvtkrlbs/bc447dbc2b91804251ec037dbb135b15 to your computer and use it in GitHub Desktop.
flake.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "Fluttravel"; | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
android = { | |
url = "github:tadfisher/android-nixpkgs"; | |
}; | |
}; | |
outputs = { | |
self, | |
nixpkgs, | |
flake-utils, | |
android, | |
}: | |
flake-utils.lib.eachDefaultSystem (system: let | |
pkgs = import nixpkgs { | |
inherit system; | |
config = { | |
allowUnfree = true; | |
android_sdk.accept_license = true; | |
}; | |
overlays = [ | |
]; | |
}; | |
#flutter-sdk = flutter-nix.packages.${system}; | |
android-sdk = android.sdk.${system} ( | |
sdkPkgs: | |
with sdkPkgs; | |
[ | |
build-tools-30-0-3 | |
build-tools-34-0-0 | |
cmdline-tools-latest | |
emulator | |
platform-tools | |
platforms-android-33 | |
sources-android-33 | |
] | |
++ pkgs.lib.optionals pkgs.stdenv.isAarch64 [ | |
system-images-android-33-google-apis-arm64-v8a | |
system-images-android-33-google-apis-playstore-arm64-v8a | |
] | |
++ pkgs.lib.optionals (!pkgs.stdenv.isAarch64) [ | |
system-images-android-33-google-apis-x86-64 | |
system-images-android-33-google-apis-x86-64 | |
] | |
); | |
in { | |
devShell = with pkgs; | |
mkShellNoCC rec { | |
buildInputs = [ | |
flutter | |
jdk | |
android-sdk | |
jdk19 | |
]; | |
JAVA_HOME = jdk19.home; | |
ANDROID_AVD_HOME = (toString ./.) + "/.android/avd"; | |
ANDROID_SDK_HOME = (toString ./.) + "/.android"; | |
ANDROID_EMULATOR_HOME = (toString ./.) + "/.android"; | |
CHROME_EXECUTABLE = "google-chrome-stable"; | |
# 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=${android-sdk}/share/android-sdk/build-tools/34.0.0/aapt2"; | |
FLUTTER_GRADLE_PLUGIN_BUILDDIR = "~/.cache/flutter/gradle-plugin"; | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment