-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
111 lines (102 loc) · 4.06 KB
/
flake.nix
File metadata and controls
111 lines (102 loc) · 4.06 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
99
100
101
102
103
104
105
106
107
108
109
110
111
{
description = "the flutter devshell definition for nixos developers";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
# not doing android builds for now, mobile is no fun
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
config.android_sdk.accept_license = true;
};
usingAndroid = false;
android = pkgs.androidenv.composeAndroidPackages {
toolsVersion = "26.1.1";
platformToolsVersion = "34.0.1";
buildToolsVersions = [ "33.0.1" ];
includeEmulator = true;
emulatorVersion = "34.1.9";
platformVersions = [ "35" ];
includeSources = false;
includeSystemImages = true;
# we need "google_apis" here but it doesn't build, nix hashes are wrong
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
cmakeVersions = [ "3.10.2" ];
includeNDK = true;
ndkVersions = [ "22.0.7026061" ];
useGoogleAPIs = true;
useGoogleTVAddOns = false;
# extraLicenses = [
# "android-googletv-license"
# "android-sdk-arm-dbt-license"
# "android-sdk-license"
# "android-sdk-preview-license"
# "google-gdk-license"
# "intel-android-extra-license"
# "intel-android-sysimage-license"
# "mips-android-sysimage-license"
# ];
};
in {
# android currently disabled
devShells.default =
pkgs.mkShell
(
{
buildInputs = with pkgs; [
flutter327
jdk17
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-libav
glibc
# you may need this for linux
# pkg-config gtk3 gtk3.dev ninja clang glibc
] ++ (if usingAndroid then [android.platform-tools] else []);
nativeBuildInputs = [pkgs.pkg-config];
shellHook = ''
export PKG_CONFIG_PATH="${pkgs.gst_all_1.gstreamer.dev}/lib/pkgconfig:${pkgs.gst_all_1.gst-plugins-base.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
export PS1="$PS1 (❄ "
'';
} // (if usingAndroid then {
JAVA_HOME = pkgs.jdk17;
ANDROID_HOME = android.androidsdk + /libexec/android-sdk;
ANDROID_AVD_HOME = (toString ./.) + "/.android/avd";
ANDROID_SDK_ROOT = android.androidsdk + /libexec/android-sdk;
} else {})
);
# needed because gradle wants to use dynamic linking or something. I don't understand why this is a problem.
# this isn't working. can't accept licenses. Unsure what happened with the above.
devShells.fhs = (pkgs.buildFHSEnv {
name = "flutter-android-env";
targetPkgs = pkgs': with pkgs'; [
flutter327
jdk17
android.platform-tools
android.androidsdk
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-libav
glibc
pkg-config
# Add any other dependencies you need
];
# profile = ''
# export ANDROID_HOME=${pkgs.android.androidsdk}/libexec/android-sdk
# export JAVA_HOME=${pkgs.jdk17}
# export ANDROID_AVD_HOME=$PWD/.android/avd
# export ANDROID_SDK_ROOT=${pkgs.android.androidsdk}/libexec/android-sdk
# '';
runScript = ''
bash
'';
}).env;
});
}