Created
December 3, 2020 03:08
-
-
Save vzctl/9a071ab8e9fc71d384696e8c5a330d47 to your computer and use it in GitHub Desktop.
WIP: Flutter / Android development on NixOS
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
# Credits: https://github.com/NixOS/nixpkgs/pull/89775 | |
{ | |
description = "Flutter / Android development on NixOS"; | |
inputs = { | |
flake-utils.url = "github:numtide/flake-utils"; | |
nixpkgs.url = "github:NixOS/nixpkgs/master"; | |
nixpkgs-androidenv.url = "github:numinit/nixpkgs/update-androidenv"; | |
# inputs.pub2nix = { url = "github:paulyoung/pub2nix"; flake = false; }; | |
pub2nix = { url = "/home/lex/x/workspace/pub2nix"; flake = false; }; | |
}; | |
outputs = inputs@{ self, nixpkgs, flake-utils, pub2nix, nixpkgs-androidenv, ... }: | |
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: | |
# flake-utils.lib.eachDefaultSystem (system: | |
let | |
pkgs = import nixpkgs { | |
inherit system; | |
config = | |
{ | |
allowUnfree = true; | |
android_sdk.accept_license = true; | |
}; | |
overlays = [ | |
(import "${pub2nix}/default.nix") | |
]; | |
}; | |
composed-androidenv = (import nixpkgs-androidenv { inherit system; config.android_sdk.accept_license = true; }).androidenv.composeAndroidPackages { | |
toolsVersion = "26.1.1"; | |
platformToolsVersion = "30.0.5"; | |
buildToolsVersions = [ "29.0.2" ]; | |
# buildToolsVersions = [ "30.0.2" "29.0.2" ]; | |
platformVersions = [ "29" "30" ]; | |
includeEmulator = true; | |
includeSources = true; | |
# does not work: attribute 'armeabi-v7a' missing | |
# includeSystemImages = true; | |
useGoogleAPIs = true; | |
extraLicenses = [ | |
# Already accepted for you with accept_license = true. | |
# "android-sdk-license" | |
# These aren't, but are useful for more uncommon setups. | |
"android-sdk-preview-license" | |
"android-googletv-license" | |
"android-sdk-arm-dbt-license" | |
"google-gdk-license" | |
"intel-android-extra-license" | |
"intel-android-sysimage-license" | |
"mips-android-sysimage-license" | |
]; | |
}; | |
in | |
rec | |
{ | |
devShell = import ./shell.nix { | |
inherit pkgs composed-androidenv; | |
}; | |
defaultPackage = import ./nix/site.nix { | |
inherit pkgs; | |
}; | |
} | |
); | |
} |
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
# | |
# Credits: https://github.com/babariviere/flutter-nix-hello-world/tree/master | |
# | |
{ pkgs, composed-androidenv }: | |
let | |
# android = pkgs.callPackage ./nix/android.nix { }; | |
env = with pkgs; bundlerEnv { | |
name = "bundler-env"; | |
inherit ruby; | |
gemfile = ./Gemfile; | |
lockfile = ./Gemfile.lock; | |
gemset = ./gemset.nix; | |
}; | |
flutter-circl = pkgs.flutter-beta; | |
in | |
with pkgs; | |
pkgs.mkShell { | |
buildInputs = [ | |
env | |
strace | |
gradle | |
glibc | |
flutter-circl | |
android-studio | |
pkgs.pub2nix.lock | |
jdk | |
composed-androidenv.androidsdk | |
]; | |
JAVA_HOME = pkgs.jdk; | |
FLUTTER_SDK = flutter-circl.unwrapped; | |
USE_CCACHE = 1; | |
ANDROID_AVD_HOME = "~/.android/avd"; | |
ANDROID_SDK_ROOT = "${composed-androidenv.androidsdk}/libexec/android-sdk"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment