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