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

41 lines
911 B
Nix
Raw Normal View History

2024-01-14 20:00:17 +02:00
{
stdenv,
runCommand,
2024-01-14 20:00:17 +02:00
python3Packages,
zopfli,
brotli,
findutils,
dart-sass,
}: let
self = stdenv.mkDerivation {
name = "e11sync-static";
2024-01-26 12:11:37 +02:00
srcs = [../app ../static];
sourceRoot = ".";
nativeBuildInputs = [
python3Packages.django
dart-sass
2024-01-17 12:59:37 +02:00
findutils
];
2024-01-26 12:11:37 +02:00
patchPhase = ''patchShebangs --build app/manage.py'';
buildPhase = ''
export E11SYNC_DEBUG=
2024-01-26 12:11:37 +02:00
make -C static style.css
app/manage.py collectstatic
2024-01-14 20:00:17 +02:00
2024-01-26 12:11:37 +02:00
find app/_static \
-name '*.css' -or \
-name '*.js' -or \
-name '*.svg' | \
tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \
xargs -n1 -P''$(nproc) ${brotli}/bin/brotli
'';
2024-01-26 12:11:37 +02:00
installPhase = ''mv app/_static $out'';
passthru.manifest = runCommand "e11sync-static-manifest" {} ''
2024-01-26 12:11:37 +02:00
mkdir -p $out
cp ${self}/staticfiles.json $out/
'';
};
in
self