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
|
{
stdenv,
runCommand,
util-linux,
moreutils,
parallel,
openssl,
libxml2,
zopfli,
brotli,
rsync,
yajl,
stylelint,
jre,
python3,
buildNpmPackage,
}:
stdenv.mkDerivation rec {
pname = "hakurei.app";
version = "20260315";
src = ./.;
nodejsEnv = buildNpmPackage {
pname = "grapheneos-nodejs";
inherit version;
src = builtins.path {
name = "${pname}-nodejs";
path = ./.;
filter =
path: _:
builtins.elem (/. + path) [
./package.json
./package-lock.json
];
};
dontNpmBuild = true;
npmFlags = [ "--ignore-scripts" ];
npmDepsHash = "sha256-N3ouirw0B1JtH171/vkA8xtsaQzWnk8+XI2OLaMLeCw=";
};
nativeBuildInputs = [
util-linux
(runCommand "sponge" { } "mkdir -p $out/bin && ln -s ${moreutils}/bin/sponge $out/bin")
parallel
openssl
libxml2
zopfli
brotli
rsync
yajl
stylelint
];
buildInputs = [
jre
(python3.withPackages (
packages: with packages; [
lxml
cssselect
jinja2
]
))
];
configurePhase = ''
runHook preConfigure
ln -s ${nodejsEnv}/lib/node_modules/${nodejsEnv.pname}/node_modules
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
sh -x process-static
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate static-tmp/ static-production
python3 generate-sitemap.py
runHook postBuild
'';
installPhase = ''
runHook preInstall
xmllint --noblanks static-tmp/sitemap.xml --output static-tmp/sitemap.xml
brotli -f static-tmp/sitemap.xml
zopfli static-tmp/sitemap.xml
rsync -rptcv --chmod=D755,F644 --delete --fsync --preallocate static-production/ $out
rsync -pcv --chmod=D755,F644 --fsync --preallocate static-tmp/sitemap.xml{,.gz,.br} $out
runHook postInstall
'';
}
|