-
Notifications
You must be signed in to change notification settings - Fork 52
/
dev.nix
67 lines (63 loc) · 2.31 KB
/
dev.nix
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
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.nodePackages.firebase-tools
pkgs.jdk17
pkgs.unzip
pkgs.flutter
];
# Sets environment variables in the workspace
env = {};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"Dart-Code.flutter"
"Dart-Code.dart-code"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
installDependencies = "flutter pub get";
build-flutter = ''
cd /home/user/myapp/android
./gradlew \
--parallel \
-Pverbose=true \
-Ptarget-platform=android-x86 \
-Ptarget=/home/user/myapp/lib/main.dart \
-Pbase-application-name=android.app.Application \
-Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \
-Pdart-obfuscation=false \
-Ptrack-widget-creation=true \
-Ptree-shake-icons=false \
-Pfilesystem-scheme=org-dartlang-root \
assembleDebug
# TODO: Execute web build in debug mode.
# flutter run does this transparently either way
# https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411
# flutter build web --profile --dart-define=Dart2jsOptimization=O0
adb -s localhost:5555 wait-for-device
'';
};
# To run something each time the workspace is (re)started, use the `onStart` hook
};
# Enable previews and customize configuration
previews = {
enable = true;
previews = {
web = {
command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"];
manager = "flutter";
};
android = {
command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"];
manager = "flutter";
};
};
};
};
}