Merge pull request #191066 from Izorkin/update-peertube-brotli

This commit is contained in:
Sandro 2022-10-18 23:35:28 +02:00 committed by GitHub
commit 397f831bd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,16 +1,5 @@
{ lib
, stdenv
, callPackage
, fetchurl
, fetchFromGitHub
, buildGoModule
, fetchYarnDeps
, nixosTests
, fixup_yarn_lock
, jq
, nodejs
, which
, yarn
{ lib, stdenv, callPackage, fetchurl, fetchFromGitHub, fetchYarnDeps, nixosTests
, brotli, fixup_yarn_lock, jq, nodejs, which, yarn
}:
let
arch =
@ -49,7 +38,7 @@ in stdenv.mkDerivation rec {
hash = "sha256-IKMu+gQa+d30+yXjHCu/oQOQXL6kTN9WxDI/Y5IL1E8=";
};
nativeBuildInputs = [ fixup_yarn_lock jq nodejs which yarn ];
nativeBuildInputs = [ brotli fixup_yarn_lock jq nodejs which yarn ];
buildPhase = ''
# Build node modules
@ -105,6 +94,12 @@ in stdenv.mkDerivation rec {
mkdir $out/client
mv ~/client/{dist,node_modules,package.json,yarn.lock} $out/client
mv ~/{config,scripts,support,CREDITS.md,FAQ.md,LICENSE,README.md,package.json,tsconfig.json,yarn.lock} $out
# 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
'';
passthru.tests.peertube = nixosTests.peertube;