about summary refs log tree commit diff
path: root/pkgs/development/libraries/glibc/default.nix
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-01-11 20:19:04 -0800
committerArtturin <Artturin@artturin.com>2023-01-13 19:16:30 +0200
commit97c335216ddd967315225aac1fb103eeafbade6e (patch)
treef15f788801cf890876d0e6d4e59679409c00735a /pkgs/development/libraries/glibc/default.nix
parente4c295a77d2b86bfb4526354ebd66535daad4003 (diff)
glibc: allow overriding common.nix
Diffstat (limited to 'pkgs/development/libraries/glibc/default.nix')
-rw-r--r--pkgs/development/libraries/glibc/default.nix18
1 files changed, 10 insertions, 8 deletions
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index 791ac47536f94..2d7e6614cecc9 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -14,16 +14,17 @@ let
   ];
 in
 
-callPackage ./common.nix { inherit stdenv; } {
-    pname = "glibc" + lib.optionalString withGd "-gd";
-
-    inherit withLinuxHeaders profilingLibraries withGd withLibcrypt;
+(callPackage ./common.nix { inherit stdenv; } {
+  inherit withLinuxHeaders withGd profilingLibraries withLibcrypt;
+  pname = "glibc" + lib.optionalString withGd "-gd";
+}).overrideAttrs(previousAttrs: {
 
     # Note:
     # Things you write here override, and do not add to,
     # the values in `common.nix`.
     # (For example, if you define `patches = [...]` here, it will
-    # override the patches in `common.nix`.)
+    # override the patches in `common.nix` -- so instead you should
+    # write `patches = (previousAttrs.patches or []) ++ [ ... ]`.
 
     NIX_NO_SELF_RPATH = true;
 
@@ -74,7 +75,7 @@ callPackage ./common.nix { inherit stdenv; } {
     # - dejagnu: during linux bootstrap tcl SIGSEGVs
     # - clang-wrapper in cross-compilation
     # Last attempt: https://github.com/NixOS/nixpkgs/pull/36948
-    preInstall = ''
+    preInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
       if [ -f ${stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
           mkdir -p $out/lib
           cp ${stdenv.cc.cc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
@@ -153,5 +154,6 @@ callPackage ./common.nix { inherit stdenv; } {
 
     separateDebugInfo = true;
 
-    meta.description = "The GNU C Library";
-  }
+  meta = (previousAttrs.meta or {}) // { description = "The GNU C Library"; };
+})
+