+1
-264
flake.lock
+1
-264
flake.lock
···
1
{
2
"nodes": {
3
-
"crane": {
4
-
"flake": false,
5
-
"locked": {
6
-
"lastModified": 1727316705,
7
-
"narHash": "sha256-/mumx8AQ5xFuCJqxCIOFCHTVlxHkMT21idpbgbm/TIE=",
8
-
"owner": "ipetkov",
9
-
"repo": "crane",
10
-
"rev": "5b03654ce046b5167e7b0bccbd8244cb56c16f0e",
11
-
"type": "github"
12
-
},
13
-
"original": {
14
-
"owner": "ipetkov",
15
-
"ref": "v0.19.0",
16
-
"repo": "crane",
17
-
"type": "github"
18
-
}
19
-
},
20
-
"dream2nix": {
21
-
"inputs": {
22
-
"nixpkgs": [
23
-
"nci",
24
-
"nixpkgs"
25
-
],
26
-
"purescript-overlay": "purescript-overlay",
27
-
"pyproject-nix": "pyproject-nix"
28
-
},
29
-
"locked": {
30
-
"lastModified": 1752547840,
31
-
"narHash": "sha256-T6wYez5urMcY8oUetwOIqPcqj77Ey3qka7wQsi6YCd4=",
32
-
"owner": "nix-community",
33
-
"repo": "dream2nix",
34
-
"rev": "667ba5ee25c95cf63ace92307db270e235dce66e",
35
-
"type": "github"
36
-
},
37
-
"original": {
38
-
"owner": "nix-community",
39
-
"repo": "dream2nix",
40
-
"type": "github"
41
-
}
42
-
},
43
-
"flake-compat": {
44
-
"flake": false,
45
-
"locked": {
46
-
"lastModified": 1696426674,
47
-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
48
-
"owner": "edolstra",
49
-
"repo": "flake-compat",
50
-
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
51
-
"type": "github"
52
-
},
53
-
"original": {
54
-
"owner": "edolstra",
55
-
"repo": "flake-compat",
56
-
"type": "github"
57
-
}
58
-
},
59
-
"mk-naked-shell": {
60
-
"flake": false,
61
-
"locked": {
62
-
"lastModified": 1681286841,
63
-
"narHash": "sha256-3XlJrwlR0nBiREnuogoa5i1b4+w/XPe0z8bbrJASw0g=",
64
-
"owner": "yusdacra",
65
-
"repo": "mk-naked-shell",
66
-
"rev": "7612f828dd6f22b7fb332cc69440e839d7ffe6bd",
67
-
"type": "github"
68
-
},
69
-
"original": {
70
-
"owner": "yusdacra",
71
-
"repo": "mk-naked-shell",
72
-
"type": "github"
73
-
}
74
-
},
75
-
"naked-shell": {
76
-
"locked": {
77
-
"lastModified": 1681286841,
78
-
"narHash": "sha256-3XlJrwlR0nBiREnuogoa5i1b4+w/XPe0z8bbrJASw0g=",
79
-
"owner": "90-008",
80
-
"repo": "mk-naked-shell",
81
-
"rev": "7612f828dd6f22b7fb332cc69440e839d7ffe6bd",
82
-
"type": "github"
83
-
},
84
-
"original": {
85
-
"owner": "90-008",
86
-
"repo": "mk-naked-shell",
87
-
"type": "github"
88
-
}
89
-
},
90
-
"nci": {
91
-
"inputs": {
92
-
"crane": "crane",
93
-
"dream2nix": "dream2nix",
94
-
"mk-naked-shell": "mk-naked-shell",
95
-
"nixpkgs": [
96
-
"nixpkgs"
97
-
],
98
-
"parts": "parts",
99
-
"rust-overlay": "rust-overlay",
100
-
"treefmt": "treefmt"
101
-
},
102
-
"locked": {
103
-
"lastModified": 1752905922,
104
-
"narHash": "sha256-fhwoEa+rjxLsRANRqh4jl4evnGpVNTLWUf4a/KDkQ3k=",
105
-
"owner": "yusdacra",
106
-
"repo": "nix-cargo-integration",
107
-
"rev": "47e02f590e1e2c72b4ffc2bcf92b2b11c3195395",
108
-
"type": "github"
109
-
},
110
-
"original": {
111
-
"owner": "yusdacra",
112
-
"repo": "nix-cargo-integration",
113
-
"type": "github"
114
-
}
115
-
},
116
"nixpkgs": {
117
"locked": {
118
"lastModified": 1752687322,
···
146
},
147
"parts": {
148
"inputs": {
149
-
"nixpkgs-lib": [
150
-
"nci",
151
-
"nixpkgs"
152
-
]
153
-
},
154
-
"locked": {
155
-
"lastModified": 1751413152,
156
-
"narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
157
-
"owner": "hercules-ci",
158
-
"repo": "flake-parts",
159
-
"rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
160
-
"type": "github"
161
-
},
162
-
"original": {
163
-
"owner": "hercules-ci",
164
-
"repo": "flake-parts",
165
-
"type": "github"
166
-
}
167
-
},
168
-
"parts_2": {
169
-
"inputs": {
170
"nixpkgs-lib": "nixpkgs-lib"
171
},
172
"locked": {
···
183
"type": "github"
184
}
185
},
186
-
"purescript-overlay": {
187
-
"inputs": {
188
-
"flake-compat": "flake-compat",
189
-
"nixpkgs": [
190
-
"nci",
191
-
"dream2nix",
192
-
"nixpkgs"
193
-
],
194
-
"slimlock": "slimlock"
195
-
},
196
-
"locked": {
197
-
"lastModified": 1728546539,
198
-
"narHash": "sha256-Sws7w0tlnjD+Bjck1nv29NjC5DbL6nH5auL9Ex9Iz2A=",
199
-
"owner": "thomashoneyman",
200
-
"repo": "purescript-overlay",
201
-
"rev": "4ad4c15d07bd899d7346b331f377606631eb0ee4",
202
-
"type": "github"
203
-
},
204
-
"original": {
205
-
"owner": "thomashoneyman",
206
-
"repo": "purescript-overlay",
207
-
"type": "github"
208
-
}
209
-
},
210
-
"pyproject-nix": {
211
-
"inputs": {
212
-
"nixpkgs": [
213
-
"nci",
214
-
"dream2nix",
215
-
"nixpkgs"
216
-
]
217
-
},
218
-
"locked": {
219
-
"lastModified": 1752481895,
220
-
"narHash": "sha256-luVj97hIMpCbwhx3hWiRwjP2YvljWy8FM+4W9njDhLA=",
221
-
"owner": "pyproject-nix",
222
-
"repo": "pyproject.nix",
223
-
"rev": "16ee295c25107a94e59a7fc7f2e5322851781162",
224
-
"type": "github"
225
-
},
226
-
"original": {
227
-
"owner": "pyproject-nix",
228
-
"repo": "pyproject.nix",
229
-
"type": "github"
230
-
}
231
-
},
232
"root": {
233
"inputs": {
234
-
"naked-shell": "naked-shell",
235
-
"nci": "nci",
236
"nixpkgs": "nixpkgs",
237
-
"parts": "parts_2",
238
-
"systems": "systems"
239
-
}
240
-
},
241
-
"rust-overlay": {
242
-
"inputs": {
243
-
"nixpkgs": [
244
-
"nci",
245
-
"nixpkgs"
246
-
]
247
-
},
248
-
"locked": {
249
-
"lastModified": 1752892850,
250
-
"narHash": "sha256-LLvDqLiK2+dr7bQqKTnZIZ8F1H67DLt3FUyVrGolGVw=",
251
-
"owner": "oxalica",
252
-
"repo": "rust-overlay",
253
-
"rev": "742248f12aed0183a124637e8b27a238a47f46a2",
254
-
"type": "github"
255
-
},
256
-
"original": {
257
-
"owner": "oxalica",
258
-
"repo": "rust-overlay",
259
-
"type": "github"
260
-
}
261
-
},
262
-
"slimlock": {
263
-
"inputs": {
264
-
"nixpkgs": [
265
-
"nci",
266
-
"dream2nix",
267
-
"purescript-overlay",
268
-
"nixpkgs"
269
-
]
270
-
},
271
-
"locked": {
272
-
"lastModified": 1688756706,
273
-
"narHash": "sha256-xzkkMv3neJJJ89zo3o2ojp7nFeaZc2G0fYwNXNJRFlo=",
274
-
"owner": "thomashoneyman",
275
-
"repo": "slimlock",
276
-
"rev": "cf72723f59e2340d24881fd7bf61cb113b4c407c",
277
-
"type": "github"
278
-
},
279
-
"original": {
280
-
"owner": "thomashoneyman",
281
-
"repo": "slimlock",
282
-
"type": "github"
283
-
}
284
-
},
285
-
"systems": {
286
-
"locked": {
287
-
"lastModified": 1680978846,
288
-
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
289
-
"owner": "nix-systems",
290
-
"repo": "x86_64-linux",
291
-
"rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8",
292
-
"type": "github"
293
-
},
294
-
"original": {
295
-
"owner": "nix-systems",
296
-
"repo": "x86_64-linux",
297
-
"type": "github"
298
-
}
299
-
},
300
-
"treefmt": {
301
-
"inputs": {
302
-
"nixpkgs": [
303
-
"nci",
304
-
"nixpkgs"
305
-
]
306
-
},
307
-
"locked": {
308
-
"lastModified": 1752055615,
309
-
"narHash": "sha256-19m7P4O/Aw/6+CzncWMAJu89JaKeMh3aMle1CNQSIwM=",
310
-
"owner": "numtide",
311
-
"repo": "treefmt-nix",
312
-
"rev": "c9d477b5d5bd7f26adddd3f96cfd6a904768d4f9",
313
-
"type": "github"
314
-
},
315
-
"original": {
316
-
"owner": "numtide",
317
-
"repo": "treefmt-nix",
318
-
"type": "github"
319
}
320
}
321
},
+7
-74
flake.nix
+7
-74
flake.nix
···
1
{
2
inputs.parts.url = "github:hercules-ci/flake-parts";
3
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
4
-
inputs.systems.url = "github:nix-systems/x86_64-linux";
5
-
inputs.naked-shell.url = "github:90-008/mk-naked-shell";
6
-
inputs.nci.url = "github:yusdacra/nix-cargo-integration";
7
-
inputs.nci.inputs.nixpkgs.follows = "nixpkgs";
8
9
outputs = inp:
10
inp.parts.lib.mkFlake {inputs = inp;} {
11
-
systems = import inp.systems;
12
-
imports = [
13
-
inp.naked-shell.flakeModule
14
-
inp.nci.flakeModule
15
-
];
16
perSystem = {
17
config,
18
-
system,
19
...
20
-
}: let
21
-
pkgs = inp.nixpkgs.legacyPackages.${system};
22
-
packageJson = builtins.fromJSON (builtins.readFile ./client/package.json);
23
-
in {
24
-
nci.projects."nsid-tracker" = {
25
-
export = false;
26
-
path = ./server;
27
};
28
-
packages.client-modules = pkgs.stdenv.mkDerivation {
29
-
pname = "${packageJson.name}-modules";
30
-
version = packageJson.version;
31
-
32
-
src = ./client;
33
-
34
-
outputHash = "sha256-TzTafbNTng/mMyf0yR9Rc6XS9/zzipwmK9SUWm2XxeY=";
35
-
outputHashAlgo = "sha256";
36
-
outputHashMode = "recursive";
37
-
38
-
nativeBuildInputs = with pkgs; [bun];
39
-
40
-
dontConfigure = true;
41
-
42
-
buildPhase = "bun install --no-cache --no-progress --frozen-lockfile";
43
-
installPhase = ''
44
-
mkdir -p $out
45
-
46
-
# Do not copy .cache or .bin
47
-
cp -R ./node_modules/* $out
48
-
cp -R ./node_modules/.bin $out
49
-
ls -la $out
50
-
'';
51
-
dontFixup = true;
52
-
dontPatchShebangs = true;
53
-
};
54
-
packages.client = pkgs.stdenv.mkDerivation {
55
-
pname = packageJson.name;
56
-
version = packageJson.version;
57
-
58
-
src = ./client;
59
-
60
-
nativeBuildInputs = [pkgs.makeBinaryWrapper];
61
-
buildInputs = [pkgs.bun];
62
-
63
-
# dontConfigure = true;
64
-
configurePhase = ''
65
-
runHook preConfigure
66
-
cp -R --no-preserve=ownership ${config.packages.client-modules} node_modules
67
-
find node_modules -type d -exec chmod 755 {} \;
68
-
substituteInPlace node_modules/.bin/vite \
69
-
--replace-fail "/usr/bin/env node" "${pkgs.bun}/bin/bun"
70
-
runHook postConfigure
71
-
'';
72
-
buildPhase = ''
73
-
runHook preBuild
74
-
bun --prefer-offline run --bun build
75
-
runHook postBuild
76
-
'';
77
-
installPhase = ''
78
-
runHook preInstall
79
-
mkdir -p $out
80
-
cp -R ./build/* $out
81
-
runHook postInstall
82
-
'';
83
-
};
84
-
packages.server = config.nci.outputs."server".packages.release;
85
};
86
};
87
}
···
1
{
2
inputs.parts.url = "github:hercules-ci/flake-parts";
3
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
4
5
outputs = inp:
6
inp.parts.lib.mkFlake {inputs = inp;} {
7
+
systems = ["x86_64-linux"];
8
perSystem = {
9
+
pkgs,
10
config,
11
...
12
+
}: {
13
+
packages.client-modules = pkgs.callPackage ./nix/client-modules.nix { };
14
+
packages.client = pkgs.callPackage ./nix/client.nix {
15
+
inherit (config.packages) client-modules;
16
};
17
+
packages.server = pkgs.callPackage ./nix/server.nix { };
18
};
19
};
20
}
+31
nix/client-modules.nix
+31
nix/client-modules.nix
···
···
1
+
{
2
+
stdenv,
3
+
bun,
4
+
}:
5
+
stdenv.mkDerivation {
6
+
pname = "client-modules";
7
+
version = "main";
8
+
9
+
src = ../client;
10
+
11
+
outputHash = "sha256-TzTafbNTng/mMyf0yR9Rc6XS9/zzipwmK9SUWm2XxeY=";
12
+
outputHashAlgo = "sha256";
13
+
outputHashMode = "recursive";
14
+
15
+
nativeBuildInputs = [bun];
16
+
17
+
dontCheck = true;
18
+
dontConfigure = true;
19
+
dontFixup = true;
20
+
dontPatchShebangs = true;
21
+
22
+
buildPhase = "bun install --no-cache --no-progress --frozen-lockfile";
23
+
installPhase = ''
24
+
mkdir -p $out
25
+
26
+
# Do not copy .cache or .bin
27
+
cp -R ./node_modules/* $out
28
+
cp -R ./node_modules/.bin $out
29
+
ls -la $out
30
+
'';
31
+
}
+40
nix/client.nix
+40
nix/client.nix
···
···
1
+
{
2
+
stdenv,
3
+
makeBinaryWrapper,
4
+
bun,
5
+
client-modules,
6
+
PUBLIC_API_URL ? "http://localhost:3713",
7
+
}:
8
+
stdenv.mkDerivation {
9
+
pname = "client";
10
+
version = "main";
11
+
12
+
src = ../client;
13
+
14
+
inherit PUBLIC_API_URL;
15
+
16
+
nativeBuildInputs = [makeBinaryWrapper];
17
+
buildInputs = [bun];
18
+
19
+
dontCheck = true;
20
+
21
+
configurePhase = ''
22
+
runHook preConfigure
23
+
cp -R --no-preserve=ownership ${client-modules} node_modules
24
+
find node_modules -type d -exec chmod 755 {} \;
25
+
substituteInPlace node_modules/.bin/vite \
26
+
--replace-fail "/usr/bin/env node" "${bun}/bin/bun --bun"
27
+
runHook postConfigure
28
+
'';
29
+
buildPhase = ''
30
+
runHook preBuild
31
+
bun --prefer-offline run --bun build
32
+
runHook postBuild
33
+
'';
34
+
installPhase = ''
35
+
runHook preInstall
36
+
mkdir -p $out
37
+
cp -R ./build/* $out
38
+
runHook postInstall
39
+
'';
40
+
}