nixosTests.nixos-rebuild-specialisations: Use modular entrypoint

Modernize it. This allows the test to be extended, and pkgs to be
reused (later) to speed up evaluations a bit.
I believe this also makes it run on darwin hosts, but my linux-builder's
disk is too small to fit the massive closure of this test.

(cherry picked from commit 1396a03bee18a0993a4f3e97fda8938ff61c2918)
This commit is contained in:
Robert Hensing 2024-09-25 11:37:57 +02:00
parent 3362ec8692
commit d6ea764629
2 changed files with 8 additions and 4 deletions

View File

@ -699,7 +699,7 @@ in {
nixops = handleTest ./nixops/default.nix {};
nixos-generate-config = handleTest ./nixos-generate-config.nix {};
nixos-rebuild-install-bootloader = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix {};
nixos-rebuild-specialisations = handleTestOn ["x86_64-linux"] ./nixos-rebuild-specialisations.nix {};
nixos-rebuild-specialisations = runTestOn ["x86_64-linux"] ./nixos-rebuild-specialisations.nix;
nixos-rebuild-target-host = runTest ./nixos-rebuild-target-host.nix;
nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; };
nixseparatedebuginfod = handleTest ./nixseparatedebuginfod.nix {};

View File

@ -1,6 +1,10 @@
import ./make-test-python.nix ({ pkgs, ... }: {
{ hostPkgs, ... }: {
name = "nixos-rebuild-specialisations";
# TODO: remove overlay from nixos/modules/profiles/installation-device.nix
# make it a _small package instead, then remove pkgsReadOnly = false;.
node.pkgsReadOnly = false;
nodes = {
machine = { lib, pkgs, ... }: {
imports = [
@ -32,7 +36,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
testScript =
let
configFile = pkgs.writeText "configuration.nix" ''
configFile = hostPkgs.writeText "configuration.nix" ''
{ lib, pkgs, ... }: {
imports = [
./hardware-configuration.nix
@ -119,4 +123,4 @@ import ./make-test-python.nix ({ pkgs, ... }: {
machine.fail("nixos-rebuild boot --specialisation foo")
machine.fail("nixos-rebuild boot -c foo")
'';
})
}