diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix index 8590cc90549a..f02be7888d09 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix +++ b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix @@ -5,7 +5,6 @@ installShellFiles, mkShell, nix, - nixosTests, python3, python3Packages, runCommand, @@ -16,6 +15,10 @@ # Very long tmp dirs lead to "too long for Unix domain socket" # SSH ControlPath errors. Especially macOS sets long TMPDIR paths. withTmpdir ? if stdenv.hostPlatform.isDarwin then "/tmp" else null, + # passthru.tests + nixosTests, + nixVersions, + nixos-rebuild-ng, }: let executable = if withNgSuffix then "nixos-rebuild-ng" else "nixos-rebuild"; @@ -105,6 +108,17 @@ python3Packages.buildPythonApplication rec { }; tests = { + with_nix_latest = nixos-rebuild-ng.override { + nix = nixVersions.latest; + }; + with_nix_stable = nixos-rebuild-ng.override { + nix = nixVersions.stable; + }; + with_nix_2_3 = nixos-rebuild-ng.override { + # oldest / minimum supported version in nixpkgs + nix = nixVersions.nix_2_3; + }; + inherit (nixosTests) nixos-rebuild-install-bootloader-ng nixos-rebuild-specialisations-ng diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_main.py b/pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_main.py index 22b7054000a8..f65975b3e22c 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_main.py +++ b/pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_main.py @@ -11,6 +11,7 @@ import pytest from pytest import MonkeyPatch import nixos_rebuild as nr +from nixos_rebuild.constants import WITH_NIX_2_18 from .helpers import get_qualified_name @@ -514,6 +515,10 @@ def test_execute_nix_switch_flake(mock_run: Mock, tmp_path: Path) -> None: @patch("subprocess.run", autospec=True) @patch("uuid.uuid4", autospec=True) @patch(get_qualified_name(nr.cleanup_ssh), autospec=True) +@pytest.mark.skipif( + not WITH_NIX_2_18, + reason="Tests internal logic based on the assumption that Nix >= 2.18", +) def test_execute_nix_switch_build_target_host( mock_cleanup_ssh: Mock, mock_uuid4: Mock,