blob: d340b77c262ce25630b53692549d48d7fdfaccf5 (
plain)
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
|
{
lib,
stdenvNoCC,
cacert,
jq,
moreutils,
nodejs,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
name = "getchoo-website";
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.gitTracked ../.;
};
__structuredAttrs = true;
nativeBuildInputs = [
nodejs
nodejs.pkgs.pnpm
];
env = {
pnpmDeps = stdenvNoCC.mkDerivation (finalAttrs': {
name = "${finalAttrs.name}-pnpm-deps";
inherit (finalAttrs) src;
__structuredAttrs = true;
nativeBuildInputs = [
cacert
jq
moreutils
nodejs.pkgs.pnpm
];
dontConfigure = true;
dontBuild = true;
doCheck = false;
installPhase = ''
runHook preInstall
export HOME="$(mktemp -d)"
pnpm config set store-dir "$out"
pnpm install --force --frozen-lockfile --ignore-script
runHook postInstall
'';
fixupPhase = ''
runHook preFixup
rm -rf "$out"/v3/tmp
for f in $(find "$out" -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
runHook postFixup
'';
outputHashMode = "recursive";
outputHash = "sha256-Rd5fdB/pMxHRwy6gRTjQQWX4OlKHUJIqh2KX+9jiBQY=";
});
};
postConfigure = ''
export HOME="$(mktemp -d)"
export STORE_PATH="$(mktemp -d)"
cp -rT "$pnpmDeps" "$STORE_PATH"
chmod -R +w "$STORE_PATH"
pnpm config set store-dir "$STORE_PATH"
pnpm install --force --frozen-lockfile --ignore-script --offline
patchShebangs node_modules/{*,.*}
'';
buildPhase = ''
runHook preBuild
pnpm run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mv dist "$out"
runHook postInstall
'';
checkPhase = ''
runHook preCheck
pnpm run check
runHook postCheck
'';
meta = with lib; {
homepage = "https://github.com/getchoo/website";
license = licenses.mit;
maintainers = with maintainers; [getchoo];
};
})
|