-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
63 lines (50 loc) · 1.14 KB
/
default.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
{ lib
, stdenvNoCC
, nodejs_22
, pnpm_9
, version
}:
let
nodejs = nodejs_22;
pnpm = pnpm_9;
NODE_ENV = "production";
fs = lib.fileset;
getSrc = mapFn: fs.toSource rec {
root = ./.;
fileset = mapFn (fs.gitTracked root);
};
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "kbf";
inherit version;
src = getSrc lib.id;
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname;
src = getSrc (fs.intersection (fs.unions [ ./package.json ./pnpm-lock.yaml ]));
env = { inherit NODE_ENV; };
hash = "sha256-foe/jPHuCMpEXIlRK7ci48//Uy/M7/lx1uYKx/zKTDE=";
};
env = {
inherit NODE_ENV;
PUBLIC_RELEASE_NAME = version;
};
nativeBuildInputs = [ pnpm.configHook ];
buildInputs = [ nodejs ];
buildPhase = ''
runHook preBuild
pnpm exec vinxi build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{opt,bin}
cp -r .output/{server,public} $out/opt
echo -e "#!${nodejs}/bin/node $out/opt/server/index.mjs" > $out/bin/kbf
chmod +x $out/bin/kbf
runHook postInstall
'';
passthru = {
inherit nodejs pnpm;
};
meta.mainProgram = "kbf";
})