From 063639b2be953d4c523a10000616d4b45e800661 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 9 Dec 2024 12:20:30 +0000 Subject: [PATCH] nixos/tests: add nixos-rebuild-specialisations-ng --- nixos/tests/all-tests.nix | 9 ++++++++- nixos/tests/nixos-rebuild-specialisations.nix | 9 ++++++--- pkgs/by-name/ni/nixos-rebuild-ng/package.nix | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index a72bf8416048..be786ee19d03 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -712,7 +712,14 @@ in { 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-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; nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; }; nixseparatedebuginfod = handleTest ./nixseparatedebuginfod.nix {}; diff --git a/nixos/tests/nixos-rebuild-specialisations.nix b/nixos/tests/nixos-rebuild-specialisations.nix index f12d0fc48ce9..31a6f31eef13 100644 --- a/nixos/tests/nixos-rebuild-specialisations.nix +++ b/nixos/tests/nixos-rebuild-specialisations.nix @@ -1,4 +1,4 @@ -{ hostPkgs, ... }: { +{ hostPkgs, lib, withNg, ... }: { name = "nixos-rebuild-specialisations"; # TODO: remove overlay from nixos/modules/profiles/installation-device.nix @@ -25,6 +25,7 @@ pkgs.grub2 ]; + system.rebuild.enableNg = withNg; system.switch.enable = true; virtualisation = { @@ -36,7 +37,7 @@ testScript = let - configFile = hostPkgs.writeText "configuration.nix" '' + configFile = hostPkgs.writeText "configuration.nix" /* nix */ '' { lib, pkgs, ... }: { imports = [ ./hardware-configuration.nix @@ -55,6 +56,8 @@ (pkgs.writeShellScriptBin "parent" "") ]; + system.rebuild.enableNg = ${lib.boolToString withNg}; + specialisation.foo = { inheritParentConfig = true; @@ -78,7 +81,7 @@ ''; in - '' + /* python */ '' machine.start() machine.succeed("udevadm settle") machine.wait_for_unit("multi-user.target") diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix index 1cd0d4f21702..c09bd8ce861f 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix +++ b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix @@ -95,7 +95,7 @@ python3Packages.buildPythonApplication rec { }; tests = { - inherit (nixosTests) nixos-rebuild-install-bootloader-ng; + inherit (nixosTests) nixos-rebuild-install-bootloader-ng nixos-rebuild-specialisations-ng; repl = callPackage ./tests/repl.nix { }; # NOTE: this is a passthru test rather than a build-time test because we # want to keep the build closures small