-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpackage.nix
More file actions
38 lines (31 loc) · 948 Bytes
/
package.nix
File metadata and controls
38 lines (31 loc) · 948 Bytes
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
{ lib, stdenv, nodejs, pnpm, contentApi, static ? false }:
let
manifest = lib.importJSON ./package.json;
in
stdenv.mkDerivation (finalAttrs: {
pname = manifest.name;
inherit (manifest) version;
src = lib.cleanSource ./.;
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
fetcherVersion = 2;
hash = "sha256-CE40fCAN7FsNCmJujojT2jSbEamjxf/iUfQYEMp737Y=";
};
nativeBuildInputs = [ nodejs pnpm.configHook ];
postPatch = ''
substituteInPlace src/app/api/api.domain.ts \
--replace-fail 'https://content.dd-ix.net' '${contentApi}'
'' + lib.optionalString static ''
substituteInPlace src/app/app.routes.server.ts \
--replace-fail 'RenderMode.Server' 'RenderMode.Client'
'';
buildPhase = ''
pnpm run ${if static then "build:static" else "build:ci"}
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r ./dist/* $out/
runHook postInstall
'';
})