fix native hosts to not build as cross

This commit is contained in:
2025-06-28 22:48:22 +00:00
parent 689d9ead5a
commit 2e7f164738
2 changed files with 5 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ in
final: prev:
let
optional = cond: overlay: if cond then overlay else (_: _: {});
isCross = prev.stdenv.hostPlatform != prev.stdenv.buildPlatform;
isCross = !(prev.lib.systems.equals prev.stdenv.hostPlatform prev.stdenv.buildPlatform);
# isCross = !(prev.stdenv.buildPlatform.canExecute prev.stdenv.hostPlatform);
isStatic = prev.stdenv.hostPlatform.isStatic;
renderOverlays = overlays: builtins.foldl'

View File

@@ -142,6 +142,9 @@ let
'';
};
elaborate = unpatchedNixpkgs.lib.systems.elaborate;
isCross = !(unpatchedNixpkgs.lib.systems.equals (elaborate system) (elaborate localSystem));
nativeNixpkgsArgs = commonNixpkgsArgs // {
config = {
allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
@@ -149,7 +152,7 @@ let
allowUnsupportedSystem = true; # NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
};
};
nixpkgsArgs = nativeNixpkgsArgs // optionalAttrs (system != localSystem) {
nixpkgsArgs = nativeNixpkgsArgs // optionalAttrs isCross {
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
crossSystem = system;