peertube: parallelize gzip and brotli step (#319092)

This commit is contained in:
Infinidoge 2024-06-11 11:43:05 -04:00 committed by GitHub
parent b15dd7203f
commit accc33c07d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,7 @@
, brotli
, fixup-yarn-lock
, jq
, fd
, nodejs
, which
, yarn
@ -76,7 +77,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "cli" "runner" ];
nativeBuildInputs = [ brotli fixup-yarn-lock jq which yarn ];
nativeBuildInputs = [ brotli fixup-yarn-lock jq which yarn fd ];
buildInputs = [ nodejs ];
@ -161,10 +162,10 @@ stdenv.mkDerivation rec {
ln -s $runner/dist/peertube-runner.js $runner/bin/peertube-runner
# Create static gzip and brotli files
find $out/client/dist -type f -regextype posix-extended -iregex '.*\.(css|eot|html|js|json|svg|webmanifest|xlf)' | while read file; do
gzip -9 -n -c $file > $file.gz
brotli --best -f $file -o $file.br
done
fd -e css -e eot -e html -e js -e json -e svg -e webmanifest -e xlf \
--type file --search-path $out/client/dist \
--exec gzip -9 -n -c {} > {}.gz \;\
--exec brotli --best -f {} -o {}.br
'';
passthru.tests.peertube = nixosTests.peertube;