47 lines
1.0 KiB
Nix
47 lines
1.0 KiB
Nix
{
|
|
stdenv,
|
|
runCommand,
|
|
python3Packages,
|
|
zopfli,
|
|
brotli,
|
|
findutils,
|
|
dart-sass,
|
|
gawk,
|
|
}: let
|
|
self = stdenv.mkDerivation {
|
|
name = "e11sync-static";
|
|
src = ../app;
|
|
nativeBuildInputs = [
|
|
python3Packages.django
|
|
python3Packages.django-compressor
|
|
dart-sass
|
|
zopfli
|
|
brotli
|
|
gawk
|
|
findutils
|
|
];
|
|
patchPhase = ''patchShebangs --build manage.py'';
|
|
buildPhase = ''
|
|
export E11SYNC_STATIC_ROOT=$PWD/static
|
|
export E11SYNC_DEBUG=
|
|
export E11SYNC_COMPRESS_OFFLINE=1
|
|
./manage.py collectstatic
|
|
./manage.py compress
|
|
|
|
find static/ \
|
|
-name '*.css' -or \
|
|
-name '*.js' -or \
|
|
-name '*.svg' | \
|
|
awk '{print "zopfli \""$0"\"";print "brotli \""$0"\""}' | \
|
|
xargs -P''$(nproc) -I{} $SHELL -c {}
|
|
'';
|
|
installPhase = ''mv static $out'';
|
|
|
|
passthru.manifest = runCommand "e11sync-static-manifest" {} ''
|
|
mkdir -p $out/CACHE
|
|
cp ${self}/CACHE/manifest.json $out/CACHE/
|
|
'';
|
|
};
|
|
in
|
|
self
|