nixosTests.nix-upgrade: fix eval

This commit is contained in:
Philip Taron
2025-08-29 09:04:48 -07:00
parent 269f0be9ee
commit f7fecd5802
2 changed files with 13 additions and 5 deletions

View File

@@ -1035,7 +1035,10 @@ in
nix-config = runTest ./nix-config.nix;
nix-ld = runTest ./nix-ld.nix;
nix-misc = handleTest ./nix/misc.nix { };
nix-upgrade = handleTest ./nix/upgrade.nix { inherit (pkgs) nixVersions; };
nix-upgrade = handleTest ./nix/upgrade.nix {
inherit (pkgs) nixVersions;
inherit system;
};
nix-required-mounts = runTest ./nix-required-mounts;
nix-serve = runTest ./nix-serve.nix;
nix-serve-ssh = runTest ./nix-serve-ssh.nix;

View File

@@ -1,10 +1,15 @@
{ pkgs, nixVersions, ... }:
{
pkgs,
nixVersions,
system,
...
}:
let
lib = pkgs.lib;
fallback-paths-external = pkgs.writeTextDir "fallback-paths.nix" ''
{
${pkgs.system} = "${nixVersions.latest}";
${system} = "${nixVersions.latest}";
}'';
nixos-module = builtins.toFile "nixos-module.nix" ''
@@ -71,7 +76,7 @@ pkgs.testers.nixosTest {
if not match: raise Exception("Couldn't find new version in output: " + result)
with subtest("nix-build-with-mismatch-daemon"):
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test\"; system = \"${pkgs.system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test\"; system = \"${system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")
with subtest("remove-new-nix"):
@@ -94,7 +99,7 @@ pkgs.testers.nixosTest {
if not match: raise Exception("Couldn't find new version in output: " + result)
with subtest("nix-build-with-new-daemon"):
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test-new\"; system = \"${pkgs.system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test-new\"; system = \"${system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")
with subtest("nix-collect-garbage-with-old-nix"):
machine.succeed("${nixVersions.stable}/bin/nix-collect-garbage")