2024-01-14 20:00:17 +02:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
python3Packages,
|
|
|
|
coreutils,
|
|
|
|
zopfli,
|
|
|
|
brotli,
|
|
|
|
findutils,
|
|
|
|
dart-sass,
|
2024-01-17 08:59:02 +02:00
|
|
|
gawk,
|
2024-01-14 20:00:17 +02:00
|
|
|
}:
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "e11sync-static";
|
2024-01-15 07:50:38 +02:00
|
|
|
src = ../app;
|
2024-01-14 20:00:17 +02:00
|
|
|
nativeBuildInputs = [
|
2024-01-16 00:34:11 +02:00
|
|
|
python3Packages.django
|
2024-01-14 20:00:17 +02:00
|
|
|
python3Packages.django-compressor
|
|
|
|
dart-sass
|
2024-01-17 08:59:02 +02:00
|
|
|
zopfli
|
|
|
|
brotli
|
2024-01-14 20:00:17 +02:00
|
|
|
];
|
2024-01-15 07:50:38 +02:00
|
|
|
patchPhase = ''patchShebangs --build manage.py'';
|
2024-01-14 20:00:17 +02:00
|
|
|
buildPhase = ''
|
|
|
|
mkdir -p static
|
|
|
|
export E11SYNC_STATIC_ROOT=static
|
|
|
|
export E11SYNC_DEBUG=
|
|
|
|
export E11SYNC_COMPRESS_OFFLINE=1
|
2024-01-15 07:50:38 +02:00
|
|
|
./manage.py collectstatic
|
|
|
|
./manage.py compress
|
2024-01-14 20:00:17 +02:00
|
|
|
|
2024-01-17 00:03:36 +02:00
|
|
|
${findutils}/bin/find static/ \
|
|
|
|
-name '*.css' -or \
|
|
|
|
-name '*.js' -or \
|
|
|
|
-name '*.svg' | \
|
2024-01-17 08:59:02 +02:00
|
|
|
${gawk}/bin/awk '{print "zopfli "$0;print "brotli "$0}' | \
|
|
|
|
${findutils}/bin/xargs -P''$(${coreutils}/bin/nproc) -I{} $SHELL -c {}
|
2024-01-14 20:00:17 +02:00
|
|
|
'';
|
|
|
|
installPhase = ''mv static $out'';
|
|
|
|
}
|