nixos/tests: add nixos-rebuild-specialisations-ng

This commit is contained in:
Thiago Kenji Okada 2024-12-09 12:20:30 +00:00
parent 81148841b9
commit 063639b2be
3 changed files with 15 additions and 5 deletions

View File

@ -712,7 +712,14 @@ in {
nixos-generate-config = handleTest ./nixos-generate-config.nix {}; nixos-generate-config = handleTest ./nixos-generate-config.nix {};
nixos-rebuild-install-bootloader = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix {}; nixos-rebuild-install-bootloader = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix {};
nixos-rebuild-install-bootloader-ng = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix { withNg = true; }; nixos-rebuild-install-bootloader-ng = handleTestOn ["x86_64-linux"] ./nixos-rebuild-install-bootloader.nix { withNg = true; };
nixos-rebuild-specialisations = runTestOn ["x86_64-linux"] ./nixos-rebuild-specialisations.nix; nixos-rebuild-specialisations = runTestOn ["x86_64-linux"] {
imports = [ ./nixos-rebuild-specialisations.nix ];
_module.args.withNg = false;
};
nixos-rebuild-specialisations-ng = runTestOn ["x86_64-linux"] {
imports = [ ./nixos-rebuild-specialisations.nix ];
_module.args.withNg = true;
};
nixos-rebuild-target-host = runTest ./nixos-rebuild-target-host.nix; nixos-rebuild-target-host = runTest ./nixos-rebuild-target-host.nix;
nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; }; nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; };
nixseparatedebuginfod = handleTest ./nixseparatedebuginfod.nix {}; nixseparatedebuginfod = handleTest ./nixseparatedebuginfod.nix {};

View File

@ -1,4 +1,4 @@
{ hostPkgs, ... }: { { hostPkgs, lib, withNg, ... }: {
name = "nixos-rebuild-specialisations"; name = "nixos-rebuild-specialisations";
# TODO: remove overlay from nixos/modules/profiles/installation-device.nix # TODO: remove overlay from nixos/modules/profiles/installation-device.nix
@ -25,6 +25,7 @@
pkgs.grub2 pkgs.grub2
]; ];
system.rebuild.enableNg = withNg;
system.switch.enable = true; system.switch.enable = true;
virtualisation = { virtualisation = {
@ -36,7 +37,7 @@
testScript = testScript =
let let
configFile = hostPkgs.writeText "configuration.nix" '' configFile = hostPkgs.writeText "configuration.nix" /* nix */ ''
{ lib, pkgs, ... }: { { lib, pkgs, ... }: {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
@ -55,6 +56,8 @@
(pkgs.writeShellScriptBin "parent" "") (pkgs.writeShellScriptBin "parent" "")
]; ];
system.rebuild.enableNg = ${lib.boolToString withNg};
specialisation.foo = { specialisation.foo = {
inheritParentConfig = true; inheritParentConfig = true;
@ -78,7 +81,7 @@
''; '';
in in
'' /* python */ ''
machine.start() machine.start()
machine.succeed("udevadm settle") machine.succeed("udevadm settle")
machine.wait_for_unit("multi-user.target") machine.wait_for_unit("multi-user.target")

View File

@ -95,7 +95,7 @@ python3Packages.buildPythonApplication rec {
}; };
tests = { tests = {
inherit (nixosTests) nixos-rebuild-install-bootloader-ng; inherit (nixosTests) nixos-rebuild-install-bootloader-ng nixos-rebuild-specialisations-ng;
repl = callPackage ./tests/repl.nix { }; repl = callPackage ./tests/repl.nix { };
# NOTE: this is a passthru test rather than a build-time test because we # NOTE: this is a passthru test rather than a build-time test because we
# want to keep the build closures small # want to keep the build closures small