-
Notifications
You must be signed in to change notification settings - Fork 3
/
shell.nix
107 lines (94 loc) · 1.86 KB
/
shell.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
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
with import <nixpkgs> {};
{
prod ? false,
should-start ? "transcendence"
}:
let
fenix = import (fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz") { };
commonDeps = [
# rust
(with fenix; with latest; combine [
minimal.toolchain
targets.wasm32-unknown-unknown.latest.rust-std
])
wasm-pack
# kil me pls
postgresql
pkgs.glibcLocales
python3
python3Packages.pip
virtualenv
gnused
glibc
];
transcendenceDeps = lib.optional (should-start == "transcendence") [
caddy
nodejs
nodePackages.pnpm
openssh
];
pongDeps = lib.optional (should-start == "pong-server") [
# hmmm
];
bonkDeps = lib.optional (should-start == "bonk-server") [
wget
godot_4
];
nonProdDeps = lib.optional (!prod) [
codespell
nodePackages.prettier
gdtoolkit
black
tmux
wget
godot_4
];
in
mkShell {
packages = commonDeps ++ transcendenceDeps ++ pongDeps ++ bonkDeps ++ nonProdDeps;
nativeBuildInputs = [ pkgs.pkg-config ];
LD_LIBRARY_PATH = lib.makeLibraryPath [ openssl ];
buildInputs = [ pkgs.openssl ];
shellHook = ''
should_start="${should-start}"
case "$should_start" in
pong-server|bonk-server)
for script in startup.d/02-source_env startup.d/03-env startup.d/09-debug; do
echo sourcing $script...
${if prod then
''
source "$script" true
''
else
''
source "$script" false
''
}
done
if [ "$should_start" = bonk-server ]; then
source startup.d/06-venv true
source startup.d/12-bonk false
fi
make "$should_start"
;;
transcendence)
for script in startup.d/*; do
echo sourcing $script...
${if prod then
''
source "$script" true
''
else
''
source "$script" false
''
}
done
;;
*)
echo invalid --arg should-start value >&2
exit 1
;;
esac
'';
}