-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathdevenv.nix
More file actions
140 lines (121 loc) · 2.96 KB
/
Copy pathdevenv.nix
File metadata and controls
140 lines (121 loc) · 2.96 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{
pkgs,
lib,
config,
...
}:
let
server_port = 8000;
in
{
android = {
enable = true;
flutter = {
enable = true;
package = pkgs.flutter327;
};
platforms.version = [
"31"
"32"
"33"
"34"
"35"
];
buildTools.version = [
"34.0.0"
];
ndk.enable = true;
googleAPIs.enable = true;
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"
];
};
languages.dart.enable = true;
packages = [
pkgs.chromium
];
env = {
CHROME_EXECUTABLE = "${pkgs.chromium}/bin/chromium";
TWAKECHAT_BASE_HREF = "/";
};
scripts._tc-build-olm-js = {
exec = ''
test -f ./assets/js/package/olm.js && exit 0;
nix_store_path=$(nix build --no-link --print-out-paths gitlab:matrix-org/olm/3.2.16?host=gitlab.matrix.org#javascript)
find "$nix_store_path/javascript" -type f \( -name "*.js" -o -name "*.wasm" \) -exec cp -v --no-preserve=all {} assets/js/package/ \;
'';
};
scripts._tc-build-web = {
exec = ''
./scripts/build-web.sh
'';
};
scripts._tc-build-android-debug = {
exec = ''
./scripts/build-android-debug.sh
'';
};
# scripts._tc-build-android-release = {
# exec = ''
# ./scripts/prepare-android-release.sh
# ./scripts/build-android-apk
# '';
# };
enterShell = ''
if [ -z "$PUB_CACHE" ]; then
export PATH="$PATH:$HOME/.pub-cache/bin"
else
export PATH="$PATH:$PUB_CACHE/bin"
fi
echo
echo 🦾 Helper scripts you can run to make your development richer:
echo 🦾
${pkgs.gnused}/bin/sed -e 's| |••|g' -e 's|=| |' <<EOF | ${pkgs.util-linuxMinimal}/bin/column -t | ${pkgs.gnused}/bin/sed -e 's|^|🦾 |' -e 's|••| |g'
${lib.generators.toKeyValue { } (lib.mapAttrs (name: value: value.description) config.scripts)}
EOF
echo
echo You are now ready to go!
echo
echo To start working on the web, please build olm.js first: _tc-build-olm-js
echo Then run flutter as usual - e.g. flutter run -d chrome
echo
echo ---
echo
echo You can also start a local NGINX server like so:
echo 1. _tc-build-web
echo 2. devenv up
echo
'';
tasks."web:build" = {
exec = "_tc-build-web";
before = [ "devenv:processes:nginx" ];
execIfModified = [
"web"
"lib"
];
};
tasks."web:update-config" = {
exec = "cat config.sample.json > build/web/config.json";
before = [ "devenv:processes:nginx" ];
after = [ "web:build" ];
execIfModified = [
"config.sample.json"
];
};
services.nginx = {
enable = true;
httpConfig = ''
server {
listen ${toString server_port};
root ${config.env.DEVENV_ROOT}/build/web;
}
'';
};
}