Skip to content

Commit

Permalink
Specify guest *system* instead of guest *packages*
Browse files Browse the repository at this point in the history
… based on feedback from @roberth

This plays nicer with other changes the user might want to make and
also works in conjunction with the `pkgsReadOnly`.

Note that this required deleting the `nixpkgs.pkgs` default because
that's not compatible with setting `nixpkgs.system`.  If `nixpkgs.pkgs`
is defined (even as a default-valued option) then `nixpkgs.system` is
ignored.
  • Loading branch information
Gabriella439 committed Feb 21, 2024
1 parent 21f534a commit 90679ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
11 changes: 5 additions & 6 deletions nixos/lib/testing/nodes.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ let

inherit (hostPkgs) hostPlatform pkgsNative;

guestPkgs =
guestSystem =
if hostPlatform.isLinux
then hostPkgs
then hostPkgs.system
else
let
hostToGuest = {
"x86_64-darwin" = pkgsNative.gnu64;
"aarch64-darwin" = pkgsNative.aarch64-multiplatform;
"x86_64-darwin" = "x86_64-linux";
"aarch64-darwin" = "aarch64-linux";
};

supportedHosts = lib.concatStringsSep ", " (lib.attrNames hostToGuest);
Expand All @@ -47,14 +47,13 @@ let
{
virtualisation.qemu.package = testModuleArgs.config.qemu.package;
virtualisation.host.pkgs = hostPkgs;
nixpkgs.pkgs = guestPkgs;
})
({ options, ... }: {
key = "nodes.nix-pkgs";
config = optionalAttrs (!config.node.pkgsReadOnly) (
mkIf (!options.nixpkgs.pkgs.isDefined) {
# TODO: switch to nixpkgs.hostPlatform and make sure containers-imperative test still evaluates.
nixpkgs.system = hostPlatform.system;
nixpkgs.system = guestSystem;
}
);
})
Expand Down
5 changes: 0 additions & 5 deletions pkgs/build-support/testers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@
(import ../../../nixos/lib/testing-python.nix {
inherit (stdenv.hostPlatform) system;
inherit pkgs;
extraConfigurations = [(
{ lib, ... }: {
config.nixpkgs.pkgs = lib.mkDefault pkgs;
}
)];
});
in
test:
Expand Down

0 comments on commit 90679ea

Please sign in to comment.