Last active
April 21, 2024 05:42
-
-
Save Frontear/40bb570dcc2fcda1182acf3a43cc9964 to your computer and use it in GitHub Desktop.
little devshell to try and build a flutter environment
This file contains hidden or 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
{ | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
}; | |
outputs = { self, ... } @ inputs: | |
let | |
# https://ayats.org/blog/no-flake-utils | |
eachSystem = function: inputs.nixpkgs.lib.genAttrs [ | |
"x86_64-linux" | |
"x86_64-darwin" | |
"aarch64-linux" | |
"aarch64-darwin" | |
] (system: function (import inputs.nixpkgs { | |
inherit system; | |
config = { | |
android_sdk.accept_license = true; | |
allowUnfree = true; | |
}; | |
})); | |
in { | |
packages = eachSystem (pkgs: { | |
default = pkgs.callPackage ({ flutter }: flutter.buildFlutterApplication { | |
pname = "flutter-app"; | |
version = "dev"; | |
src = ./src; | |
autoPubspecLock = ./src/pubspec.lock; | |
}) {}; | |
}); | |
devShells = eachSystem (pkgs: | |
let | |
inherit (pkgs) androidenv lib; | |
androidSdk = (androidenv.composeAndroidPackages { | |
buildToolsVersions = [ "34.0.0" ]; | |
cmdLineToolsVersion = "11.0"; | |
platformToolsVersion = "34.0.5"; | |
platformVersions = [ "34" ]; | |
includeEmulator = true; | |
emulatorVersion = "34.1.9"; | |
includeSystemImages = true; | |
includeSources = true; | |
extraLicenses = [ | |
"android-googletv-license" | |
"android-sdk-arm-dbt-license" | |
"android-sdk-preview-license" | |
"google-gdk-license" | |
"mips-android-sysimage-license" | |
]; | |
}).androidsdk; | |
in { | |
default = pkgs.mkShell { | |
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk"; | |
CHROME_EXECUTABLE = lib.getExe pkgs.google-chrome; | |
buildInputs = with pkgs; [ | |
android-studio | |
pkg-config | |
pcre | |
gtk3 | |
flutter | |
androidSdk | |
jdk17 | |
]; | |
}; | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to get this running: