-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
98 lines (93 loc) · 3.54 KB
/
Copy pathflake.nix
File metadata and controls
98 lines (93 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
description = "Reproducible Flutter and Android development environment for Fidget Toys";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
in
{
devShells = forEachSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};
androidComposition = pkgs.androidenv.composeAndroidPackages {
platformVersions = [ "36" ];
buildToolsVersions = [ "36.0.0" ];
includeEmulator = false;
includeSystemImages = false;
includeNDK = true;
ndkVersions = [ "28.2.13676358" ];
# Flutter's sdkmanager check evaluates every current Android SDK
# repository license family, not only the installed packages.
# These are accepted declaratively under android_sdk.accept_license.
extraLicenses = [
"android-googletv-license"
"android-googlexr-license"
"android-sdk-arm-dbt-license"
"android-sdk-preview-license"
"google-gdk-license"
"mips-android-sysimage-license"
];
};
androidSdk = androidComposition.androidsdk;
in
{
default = pkgs.mkShell {
packages = with pkgs; [
flutter
jdk17
androidSdk
avahi
git
just
python3
imagemagick
curl
unzip
xz
zip
];
ANDROID_HOME = "${androidSdk}/libexec/android-sdk";
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
ANDROID_NDK_ROOT = "${androidSdk}/libexec/android-sdk/ndk/28.2.13676358";
JAVA_HOME = pkgs.jdk17.home;
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/36.0.0/aapt2";
FLUTTER_SUPPRESS_ANALYTICS = "true";
shellHook = ''
# mkShell inherits the host PATH. Remove only entries that expose
# an adb different from this SDK's platform-tools binary so
# Flutter doctor sees one coherent Android toolchain.
canonical_adb="$ANDROID_SDK_ROOT/platform-tools/adb"
if [ -x "$canonical_adb" ]; then
canonical_adb_real="$(readlink -f "$canonical_adb")"
filtered_path=""
previous_ifs="$IFS"
IFS=:
for path_entry in $PATH; do
[ -n "$path_entry" ] || continue
candidate_adb="$path_entry/adb"
if [ -x "$candidate_adb" ] \
&& [ "$(readlink -f "$candidate_adb")" != "$canonical_adb_real" ]; then
continue
fi
filtered_path="''${filtered_path:+$filtered_path:}$path_entry"
done
IFS="$previous_ifs"
export PATH="$filtered_path"
fi
if [ -t 1 ]; then
echo "Fidget Toys development shell"
echo "Android SDK: $ANDROID_SDK_ROOT"
echo "Run just env for a full environment check."
fi
'';
};
});
};
}