Skip to content

Commit

Permalink
nix: fix closure bloat on nix
Browse files Browse the repository at this point in the history
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 3199943)
Signed-off-by: Domen Kožar <domen@dev.si>
  • Loading branch information
flokli authored and domenkozar committed Jan 8, 2021
1 parent 1fcd4b4 commit b007eef
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkgs/tools/package-management/nix/default.nix
Expand Up @@ -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;

Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit b007eef

Please sign in to comment.