about summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/chromium/common.nix
diff options
context:
space:
mode:
authoremilylange <git@emilylange.de>2023-10-15 23:48:48 +0200
committeremilylange <git@emilylange.de>2023-10-16 12:08:42 +0200
commit97738d7a1715d8022fd9d6e11e45586a56d9bdec (patch)
treeb73044263a023ded89cfd75afe552cec989b5830 /pkgs/applications/networking/browsers/chromium/common.nix
parentb679d0db5d55553f72bdd2d41f7f23164023943e (diff)
chromium: delete unused paths in source tarball
to stay below hydra limit.

At the time of writing, the hydra.nixos.org's output limit is 3 GB.
The latest chromium tarball, however, is slightly above that.

To work around this, recompress the original `tar.xz` into a `tar.zstd`
and delete two unreasonably big and unused directories.

Bringing it down to roughtly 2.2 GB.

Unfortunately, this change breaks the `update.py` script.

Resolves the current channel-blocker.
Diffstat (limited to 'pkgs/applications/networking/browsers/chromium/common.nix')
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index 562fbbbb3061f..c527731bb6921 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -1,4 +1,5 @@
 { stdenv, lib, fetchurl, fetchpatch
+, fetchzip, zstd
 , buildPackages
 , pkgsBuildBuild
 , pkgsBuildTarget
@@ -152,9 +153,30 @@ let
     inherit (upstream-info) version;
     inherit packageName buildType buildPath;
 
-    src = fetchurl {
+    src = fetchzip {
+      name = "chromium-${version}.tar.zstd";
       url = "https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${version}.tar.xz";
       inherit (upstream-info) sha256;
+
+      nativeBuildInputs = [ zstd ];
+
+      postFetch = ''
+        echo removing unused code from tarball to stay under hydra limit
+        rm -r $out/third_party/{rust-src,llvm}
+
+        echo moving remains out of \$out
+        mv $out source
+
+        echo recompressing final contents into new tarball
+        # try to make a deterministic tarball
+        tar \
+          --use-compress-program "zstd -T$NIX_BUILD_CORES" \
+          --sort name \
+          --mtime 1970-01-01 \
+          --owner=root --group=root \
+          --numeric-owner --mode=go=rX,u+rw,a-s \
+          -cf $out source
+      '';
     };
 
     nativeBuildInputs = [