about summary refs log tree commit diff
path: root/pkgs/servers/peertube
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/peertube')
-rw-r--r--pkgs/servers/peertube/default.nix23
1 files changed, 9 insertions, 14 deletions
diff --git a/pkgs/servers/peertube/default.nix b/pkgs/servers/peertube/default.nix
index 29e082e65cf2e..9ddad4fad1e89 100644
--- a/pkgs/servers/peertube/default.nix
+++ b/pkgs/servers/peertube/default.nix
@@ -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;