From 97c335216ddd967315225aac1fb103eeafbade6e Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 11 Jan 2023 20:19:04 -0800 Subject: [PATCH] glibc: allow overriding common.nix --- pkgs/development/libraries/glibc/common.nix | 7 +------ pkgs/development/libraries/glibc/default.nix | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 61c0c92d5280aa3..22e566fb8b3142b 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -37,7 +37,6 @@ , profilingLibraries ? false , withGd ? false , withLibcrypt ? false -, meta , extraBuildInputs ? [] , extraNativeBuildInputs ? [] , ... @@ -264,9 +263,5 @@ stdenv.mkDerivation ({ maintainers = with maintainers; [ eelco ma27 ]; platforms = platforms.linux; - } // meta; -} - -// lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) { - preInstall = null; # clobber the native hook + } // (args.meta or {}); }) diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix index 791ac47536f94ed..2d7e6614cecc966 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"; }; +}) +