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,
|
|
|
|
zopfli,
|
|
|
|
brotli,
|
|
|
|
findutils,
|
|
|
|
dart-sass,
|
2024-01-17 12:53:14 +02:00
|
|
|
}: let
|
|
|
|
self = stdenv.mkDerivation {
|
|
|
|
name = "e11sync-static";
|
2024-01-26 12:11:37 +02:00
|
|
|
srcs = [../app ../static];
|
|
|
|
sourceRoot = ".";
|
2024-01-17 12:53:14 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
python3Packages.django
|
|
|
|
dart-sass
|
2024-01-17 12:59:37 +02:00
|
|
|
findutils
|
2024-01-17 12:53:14 +02:00
|
|
|
];
|
2024-01-26 12:11:37 +02:00
|
|
|
patchPhase = ''patchShebangs --build app/manage.py'';
|
2024-01-17 12:53:14 +02:00
|
|
|
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 \
|
2024-01-17 12:53:14 +02:00
|
|
|
-name '*.css' -or \
|
|
|
|
-name '*.js' -or \
|
|
|
|
-name '*.svg' | \
|
2024-01-19 13:27:41 +02:00
|
|
|
tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \
|
|
|
|
xargs -n1 -P''$(nproc) ${brotli}/bin/brotli
|
2024-01-17 12:53:14 +02:00
|
|
|
'';
|
2024-01-26 12:11:37 +02:00
|
|
|
installPhase = ''mv app/_static $out'';
|
2024-01-17 10:45:16 +02:00
|
|
|
|
2024-01-17 12:53:14 +02:00
|
|
|
passthru.manifest = runCommand "e11sync-static-manifest" {} ''
|
2024-01-26 12:11:37 +02:00
|
|
|
mkdir -p $out
|
|
|
|
cp ${self}/staticfiles.json $out/
|
2024-01-17 12:53:14 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
self
|