Commit 5517af77 authored by Samuel Ainsworth's avatar Samuel Ainsworth
Browse files

buildBazelPackage: don't gzip deps tarball

The gzip compression is unnecessary since the tarball is used as an intermediate
build artifact and is never transferred over the network in normal operation.
Removing it speeds up both the fetch and build phases, and saves a few
electrons.

Additionally, gzipping can circumvent the scanner that checks for /nix/store
paths in fixed-output derivation outputs, violating that invariant.

See https://github.com/NixOS/nixpkgs/pull/495323#issuecomment-4006358010
parent ea686ef8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ stdenv.mkDerivation (
    deps = stdenv.mkDerivation (
      fFetchAttrs
      // {
        name = "${name}-deps.tar.gz";
        name = "${name}-deps.tar";

        impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ fFetchAttrs.impureEnvVars or [ ];

@@ -232,7 +232,7 @@ stdenv.mkDerivation (

              echo '${bazel.name}' > $bazelOut/external/.nix-bazel-version

              (cd $bazelOut/ && tar czf $out --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner external/)
              (cd $bazelOut/ && tar cf $out --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner external/)

              runHook postInstall
            ''
@@ -261,7 +261,7 @@ stdenv.mkDerivation (
    preConfigure = ''
      mkdir -p "$bazelOut"

      (cd $bazelOut && tar xfz $deps)
      (cd $bazelOut && tar xf $deps)

      test "${bazel.name}" = "$(<$bazelOut/external/.nix-bazel-version)" || {
        echo "fixed output derivation was built for a different bazel version" >&2
+5 −2
Original line number Diff line number Diff line
@@ -45,10 +45,13 @@ buildBazelPackage rec {
  removeRulesCC = false;

  fetchAttrs = {
    preInstall = ''
      rm -rf $bazelOut/external/rules_shell~~sh_configure~local_config_shell
    '';
    hash =
      {
        aarch64-linux = "sha256-vg2U7v68Tn6cxPakeWir8TpHL3oMxZ2AzJ68TMR1+/E=";
        x86_64-linux = "sha256-jIffzBTO+5VMX73vV4XPlGv7/26oMLXpYdb0vzFgulc=";
        aarch64-linux = "sha256-E70F3D7HGsyV0bPd0zbRTytx1UCHyEuNKObaG2eRy8A=";
        x86_64-linux = "sha256-E9XAKrt16DOAne3/wY9PwWIM61YX0fWs8x1hqF3YJSU=";
      }
      .${system} or (throw "No hash for system: ${system}");
  };
+2 −2
Original line number Diff line number Diff line
@@ -49,8 +49,8 @@ let
      depsHash
    else
      {
        x86_64-linux = "sha256-CMd8dIyvuYFoHg1+AdkkyBj5P367ZcklCOgih+7uQIA=";
        aarch64-linux = "sha256-NJIkiTIJBZFPb+FpTYo6pQQQt8++VuCHHj0Y0AjqWGo=";
        x86_64-linux = "sha256-CUWT2EIHG9vWo4aUbA18SpYn2HTa9haWNo7lGLN8ihw=";
        aarch64-linux = "sha256-bdFQlvBi7UG2oV8h74geNZbDQCXh+4oIQxD8JNtpWf4=";
      }
      .${stdenv.system} or (throw "unsupported system ${stdenv.system}");

+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ buildBazelPackage {
      rm -rv "$bazelOut"/external/host_platform
    '';

    hash = "sha256-nFPGhZWvzzBOSeIa35XQbK6dHgJJSYum/5X8eAA0uCY=";
    hash = "sha256-ZjrXMQwxlaU5YGZtBZ+D2XBQHnOk+zV+a9cmkf3U5NU=";
  };

  preConfigure = ''
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ buildBazelPackage rec {
  bazel = bazel_7;

  fetchAttrs = {
    hash = "sha256-c+v2vWvTmwJ7MFh3VJlUh+iSINjsX66W9K0UBX5K/1s=";
    hash = "sha256-G05vlHiOJp4rvQBUj2ffRBuWBA/lpJju8CLiopYJckE=";

    preInstall = ''
      # Remove zip code data. It will be replaced with jp-zip-codes from nixpkgs
Loading