about summary refs log tree commit diff
path: root/pkgs/stdenv/linux
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-01-09 00:09:53 -0800
committerAdam Joseph <adam@westernsemico.com>2023-04-02 03:04:20 -0700
commit70d34589bd7b890afc1eeafa0eb739fbf6676df0 (patch)
tree19cc61dcda091efccf820ce448cfc15129fc2121 /pkgs/stdenv/linux
parent87225ff54dd632653480a68cb4223eb24d972d35 (diff)
stdenv/linux: factor out commonGccOverrides
This commit has no effect on eval.  It simply factors out a common
subexpression.
Diffstat (limited to 'pkgs/stdenv/linux')
-rw-r--r--pkgs/stdenv/linux/default.nix15
1 files changed, 9 insertions, 6 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 51f217f03b276..1ce284f656013 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -111,6 +111,13 @@ let
   isBuiltByBootstrapFilesCompiler =
     pkg: isFromNixpkgs pkg && isFromBootstrapFiles pkg.stdenv.cc.cc;
 
+  commonGccOverrides = {
+    # Use a deterministically built compiler
+    # see https://github.com/NixOS/nixpkgs/issues/108475 for context
+    reproducibleBuild = true;
+    profiledCompiler = false;
+  };
+
   commonPreHook =
     ''
       export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
@@ -396,7 +403,7 @@ in
         let makeStaticLibrariesAndMark = pkg:
               lib.makeOverridable (pkg.override { stdenv = self.makeStaticLibraries self.stdenv; })
                 .overrideAttrs (a: { pname = "${a.pname}-stage3"; });
-        in super.gcc-unwrapped.override {
+        in super.gcc-unwrapped.override (commonGccOverrides // {
         # Link GCC statically against GMP etc.  This makes sense because
         # these builds of the libraries are only used by GCC, so it
         # reduces the size of the stdenv closure.
@@ -404,11 +411,7 @@ in
         mpfr = makeStaticLibrariesAndMark super.mpfr;
         libmpc = makeStaticLibrariesAndMark super.libmpc;
         isl = makeStaticLibrariesAndMark super.isl_0_20;
-        # Use a deterministically built compiler
-        # see https://github.com/NixOS/nixpkgs/issues/108475 for context
-        reproducibleBuild = true;
-        profiledCompiler = false;
-      };
+        });
     };
     extraNativeBuildInputs = [ prevStage.patchelf ] ++
       # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.