lib/tests/release.nix: Fix build if impure.nix returns a cross pkgs

In https://www.github.com/NixOS/nixpkgs/pull/341067 `ofborg-eval-lib-tests`
fails because it uses `pkgsHostTarget` of the cross pkgs

```diff
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index 4d847e280f4b..7f0099b254f0 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -86,4 +86,6 @@ assert args ? system -> !(args ? localSystem);

 import ./. (builtins.removeAttrs args [ "system" ] // {
   inherit config overlays localSystem;
-})
+} // (if ((localSystem.system or localSystem) == "x86_64-linux" || (localSystem.system or localSystem) == "aarch64-linux") then {
+  crossSystem = { config = "aarch64-unknown-linux-gnu"; };
+  } else {}) )
```
This commit is contained in:
Artturin 2024-12-09 20:04:11 +02:00
parent c9b3b5de62
commit 764c99481a

View File

@ -1,18 +1,23 @@
{ # The pkgs used for dependencies for the testing itself { # The pkgs used for dependencies for the testing itself
# Don't test properties of pkgs.lib, but rather the lib in the parent directory # Don't test properties of pkgs.lib, but rather the lib in the parent directory
pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; }, pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; },
# For testing someone may edit impure.nix to return cross pkgs, use `pkgsBuildBuild` directly so everything here works.
pkgsBB ? pkgs.pkgsBuildBuild,
nix ? pkgs-nixVersions.stable, nix ? pkgs-nixVersions.stable,
nixVersions ? [ pkgs-nixVersions.minimum nix pkgs-nixVersions.latest ], nixVersions ? [ pkgs-nixVersions.minimum nix pkgs-nixVersions.latest ],
pkgs-nixVersions ? import ./nix-for-tests.nix { inherit pkgs; }, pkgs-nixVersions ? import ./nix-for-tests.nix { pkgs = pkgsBB; },
}: }:
let let
lib = import ../.; lib = import ../.;
testWithNix = nix: testWithNix = nix:
import ./test-with-nix.nix { inherit lib nix pkgs; }; import ./test-with-nix.nix {
inherit lib nix;
pkgs = pkgsBB;
};
in in
pkgs.symlinkJoin { pkgsBB.symlinkJoin {
name = "nixpkgs-lib-tests"; name = "nixpkgs-lib-tests";
paths = map testWithNix nixVersions; paths = map testWithNix nixVersions;
} }