-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpackage.nix
37 lines (30 loc) · 907 Bytes
/
package.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
{ lib, stdenv, nodejs, pnpm, contentApi, static ? false }:
let
manifest = lib.importJSON ./package.json;
in
stdenv.mkDerivation (finalAttrs: {
pname = "website";
inherit (manifest) version;
src = lib.cleanSourceWith {
filter = name: type: ((!lib.hasSuffix ".nix" name) && (builtins.dirOf name) != "node_modules");
src = lib.cleanSource ./.;
};
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-ZeOl8rjUdPlVDhyeZq1ZROqLb1ef2ZaIQ0IDWwO7cAA=";
};
nativeBuildInputs = [ nodejs pnpm.configHook ];
postPatch = ''
substituteInPlace src/app/api/api.domain.ts \
--replace-fail 'https://content.dd-ix.net' '${contentApi}'
'';
buildPhase = ''
pnpm run ${if static then "build:static" else "build:ci"}
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r ./dist/* $out/
runHook postInstall
'';
})