From b007eef8e23a6c4f345fe7ed283e9c58ef6873bd Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 31 Dec 2020 19:48:42 +0100 Subject: [PATCH] nix: fix closure bloat on `nix` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The conditional preventing closure bloat unfortunately didn't apply for the `nix` attribute, which is at 2.3.10 (not 2.4.*, what this did check for). Due to the somewhat funny 2.4pre* version strings used for nixUnstable not being understood by lib.versionOlder, we also need to explicitly add a check for that. (cherry picked from commit 31999436daf18dc4f98559304aa846613dd821bb) Signed-off-by: Domen Kožar --- pkgs/tools/package-management/nix/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 0177920766a3dd..00be6f5aab0e38 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -34,7 +34,6 @@ common = version = lib.getVersion name; is24 = lib.versionAtLeast version "2.4pre"; - isExactly24 = lib.versionAtLeast version "2.4" && lib.versionOlder version "2.4"; VERSION_SUFFIX = suffix; @@ -94,9 +93,15 @@ common = patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* ''} '' + - # For Nix 2.4, patch around an issue where the Nix configure step pulls in the - # build system's bash and other utilities when cross-compiling - lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform && isExactly24) '' + # On all versions before c9f51e87057652db0013289a95deffba495b35e7, + # released with 2.3.8, we need to patch around an issue where the Nix + # configure step pulls in the build system's bash and other utilities + # when cross-compiling. + lib.optionalString ( + stdenv.buildPlatform != stdenv.hostPlatform && + (lib.versionOlder "2.3.8" (lib.traceVal version) && !is24) + # The additional is24 condition is required as versionOlder doesn't understand nixUnstable version strings + ) '' mkdir tmp/ substitute corepkgs/config.nix.in tmp/config.nix.in \ --subst-var-by bash ${bash}/bin/bash \