1
Fork 0
e11sync/pkgs/e11sync-static.nix

33 lines
751 B
Nix

{
stdenv,
python3Packages,
coreutils,
zopfli,
brotli,
findutils,
dart-sass,
}:
stdenv.mkDerivation {
name = "e11sync-static";
src = ../app;
nativeBuildInputs = [
python3Packages.django_5
python3Packages.django-compressor
dart-sass
];
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
${findutils}/bin/find static/CACHE -name '*.css' | \
${findutils}/bin/xargs -P''$(${coreutils}/bin/nproc) -I{} sh -c \
"${zopfli}/bin/zopfli {} && ${brotli}/bin/brotli {}"
'';
installPhase = ''mv static $out'';
}