2024-01-14 20:00:17 +02:00
|
|
|
{
|
|
|
|
stdenv,
|
2024-01-17 10:45:16 +02:00
|
|
|
runCommand,
|
2024-01-14 20:00:17 +02:00
|
|
|
python3Packages,
|
|
|
|
coreutils,
|
|
|
|
zopfli,
|
|
|
|
brotli,
|
|
|
|
findutils,
|
|
|
|
dart-sass,
|
2024-01-17 08:59:02 +02:00
|
|
|
gawk,
|
2024-01-17 12:53:14 +02:00
|
|
|
}: let
|
|
|
|
self = stdenv.mkDerivation {
|
|
|
|
name = "e11sync-static";
|
|
|
|
src = ../app;
|
|
|
|
nativeBuildInputs = [
|
|
|
|
python3Packages.django
|
|
|
|
python3Packages.django-compressor
|
|
|
|
dart-sass
|
|
|
|
zopfli
|
|
|
|
brotli
|
|
|
|
];
|
|
|
|
patchPhase = ''patchShebangs --build manage.py'';
|
|
|
|
buildPhase = ''
|
|
|
|
mkdir -p static
|
|
|
|
export E11SYNC_STATIC_ROOT=static
|
|
|
|
export E11SYNC_DEBUG=
|
|
|
|
export E11SYNC_COMPRESS_OFFLINE=1
|
|
|
|
./manage.py collectstatic
|
|
|
|
./manage.py compress
|
2024-01-14 20:00:17 +02:00
|
|
|
|
2024-01-17 12:53:14 +02:00
|
|
|
${findutils}/bin/find static/ \
|
|
|
|
-name '*.css' -or \
|
|
|
|
-name '*.js' -or \
|
|
|
|
-name '*.svg' | \
|
|
|
|
${gawk}/bin/awk '{print "zopfli "$0;print "brotli "$0}' | \
|
|
|
|
${findutils}/bin/xargs -P''$(${coreutils}/bin/nproc) -I{} $SHELL -c {}
|
|
|
|
'';
|
|
|
|
installPhase = ''mv static $out'';
|
2024-01-17 10:45:16 +02:00
|
|
|
|
2024-01-17 12:53:14 +02:00
|
|
|
passthru.manifest = runCommand "e11sync-static-manifest" {} ''
|
|
|
|
mkdir -p $out/CACHE
|
|
|
|
cp ${self}/CACHE/manifest.json $out/CACHE/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
self
|