NixOS Integration Tests on macOS: Remove some obstacles (ulimit, requiredSystemFeatures)#261694
NixOS Integration Tests on macOS: Remove some obstacles (ulimit, requiredSystemFeatures)#261694tfc wants to merge 4 commits intoNixOS:masterfrom
Conversation
ec099bd to
532773f
Compare
532773f to
f10148a
Compare
343b5ce to
37d2650
Compare
There was a problem hiding this comment.
Would be nice to have pkgsLinux, like we have pkgsStatic or pkgsCross.<x> (although this wouldn't be cross; just a related platform that's built natively)
There was a problem hiding this comment.
Or pkgsNativePlatform.linux or something, with native referring both to not being cross and being able to run on the same hardware that runs pkgs.
There was a problem hiding this comment.
True. Although this would blow up this PR... can we discuss this offline after this PR how to improve it?
nixos/lib/testing/macos-host.nix
Outdated
There was a problem hiding this comment.
This line doesn't seem darwin-specific.
There was a problem hiding this comment.
so what do you think is the best way to do it? use !...isLinux ?
There was a problem hiding this comment.
I think this could be set in this module, here
nixpkgs/nixos/lib/testing/nodes.nix
Line 29 in 589c74a
I can't think of a situation where host.pkgs and hostPkgs should not have the same value.
There was a problem hiding this comment.
Not sure how you mean that... use hostPkgs instead of ...config.qemu.package? I guess you mean that the default value for that should be hostpkgs but then in the file where this is defined?
There was a problem hiding this comment.
I meant it like
virtualisation.qemu.package = testModuleArgs.config.qemu.package;
+virtualisation.host.pkgs = hostPkgs;ie move the line away from here
| virtualisation.host.pkgs = hostPkgs; |
and into lib/testing/nodes.nix.
The virtualisation.qemu.package line is unchanged and unrelated.
|
The NixOS test shown in the example runs locally for me 👍 |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/run-nixos-interactive-tests-on-aarch64-darwin/34534/2 |
everything for macOS
1566a37 to
65b5201
Compare
Based on my local testing these options seem unnecessary and the VM runs fine without them being set. I originally cargo-culted these from NixOS#261694 but they don't seem necessary.
Closes #193336 Closes #261694 Related to #108984 The goal here was to get the following flake to build and run on `aarch64-darwin`: ```nix { inputs.nixpkgs.url = <this branch>; outputs = { nixpkgs, ... }: { checks.aarch64-darwin.default = nixpkgs.legacyPackages.aarch64-darwin.nixosTest { name = "test"; nodes.machine = { }; testScript = ""; }; }; } ``` … and after this change it does. There's no longer a need for the user to set `nodes.*.nixpkgs.pkgs` or `nodes.*.virtualisation.host.pkgs` as the correct values are inferred from the host system.
Closes NixOS#193336 Closes NixOS#261694 Related to 108984 This pull request is a composite of the changes from NixOS#193336 and also NixOS#261694, with some changes of my own that I made. The goal here was to get the following flake to build and run on `aarch64-darwin`: ```nix { inputs.nixpkgs.url = <this branch>; outputs = { nixpkgs, ... }: { checks.aarch64-darwin.default = nixpkgs.legacyPackages.aarch64-darwin.nixosTest { name = "test"; nodes.machine = { }; testScript = ""; }; }; } ``` … and after this change it does. There's no longer a need for the user to set `nodes.*.nixpkgs.pkgs` or `nodes.*.virtualisation.host.pkgs` as the correct values are inferred from the host system. This change is spiritually much closer to the approach in NixOS#261694 than the approach in NixOS#193336. However, I still made a few changes compared to NixOS#261694: - I didn't include the change to increase `ulimit` I think this change was questionable because I feel like a script provided by Nixpkgs shouldn't be tinkering with the user's ambient `ulimit` settings. - I named the required system feature `hvf` instead of `apple-virt` I preferred the `hvf` system feature name chosen by NixOS#193336. - I didn't use the `node.pkgs` setting to set `nodes.*.nixpkgs.pkgs` That does not work, based on my testing, but setting the same thing in `nixos/lib/testing/nodes.nix` does work. - I created a `pkgsLocal` helper This is based on the feedback from @roberth here: https://github.com/NixOS/nixpkgs/pull/261694/files#r1365443955 … and is similar in spirit to `pkgsCross`.
Description of changes
I got a step towards running NixOS integration tests on macOS without modifications in the test, other than the ones on nixpkgs in this PR.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)