diff --git a/pkgs/test/top-level/stage.nix b/pkgs/test/top-level/stage.nix index 1a28a5aeaa12d6..0fd287cac8a548 100644 --- a/pkgs/test/top-level/stage.nix +++ b/pkgs/test/top-level/stage.nix @@ -98,9 +98,8 @@ assert isComposable "pkgsStatic"; assert isComposable "pkgsi686Linux"; # Special cases regarding buildPlatform vs hostPlatform -# TODO: fails -# assert discardEvaluationErrors (pkgsCross.gnu64.pkgsMusl.stdenv.hostPlatform.isMusl); -# assert discardEvaluationErrors (pkgsCross.gnu64.pkgsi686Linux.stdenv.hostPlatform.isx86_32); +assert discardEvaluationErrors (pkgsCross.gnu64.pkgsMusl.stdenv.hostPlatform.isMusl); +assert discardEvaluationErrors (pkgsCross.gnu64.pkgsi686Linux.stdenv.hostPlatform.isx86_32); assert discardEvaluationErrors (pkgsCross.mingwW64.pkgsLinux.stdenv.hostPlatform.isLinux); assert discardEvaluationErrors ( pkgsCross.aarch64-darwin.pkgsx86_64Darwin.stdenv.hostPlatform.isx86_64 diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 50ea964844e247..bc810e9e79a895 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -191,10 +191,13 @@ let (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // crossAttrs; }); # This is only cross when we are already cross, otherwise local. - mkHybridPkgs = name: hybridAttrs: mkPkgs name (prevArgs: { - ${if stdenv.hostPlatform == stdenv.buildPlatform then "localSystem" else "crossSystem"} = - (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // hybridAttrs; - }); + # For the case of "native cross", i.e. pkgsCross.gnu64 on a x86_64-linux system, we need to adjust **both** + # localSystem **and** crossSystem, otherwise they're out of sync. + mkHybridPkgs = name: hybridAttrs: mkPkgs name (prevArgs: let + newSystem = (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // hybridAttrs; + in lib.optionalAttrs (stdenv.hostPlatform == stdenv.buildPlatform) { localSystem = newSystem; } + // lib.optionalAttrs (prevArgs ? crossSystem) { crossSystem = newSystem; } + ); in self: super: { # This maps each entry in lib.systems.examples to its own package # set. Each of these will contain all packages cross compiled for