1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 20:21:14 +00:00

peertube: create static gzip and brotli files

This commit is contained in:
Izorkin 2022-09-13 15:52:40 +03:00
parent 98fd494fd0
commit 06f1cdf56c
No known key found for this signature in database
GPG key ID: 1436C1B3F3679F09

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;