nixos.runTest: Add extendNixOS

This commit is contained in:
Robert Hensing
2025-07-06 13:37:55 +02:00
parent 63e2606ddf
commit f2b3aeb383
4 changed files with 97 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ testModuleArgs@{
lib,
hostPkgs,
nodes,
options,
...
}:
@@ -73,6 +74,9 @@ let
];
};
# TODO (lib): Dedup with run.nix, add to lib/options.nix
mkOneUp = opt: f: lib.mkOverride (opt.highestPrio - 1) (f opt.value);
in
{
@@ -233,5 +237,23 @@ in
))
];
# Docs: nixos/doc/manual/development/writing-nixos-tests.section.md
/**
See https://nixos.org/manual/nixos/unstable#sec-override-nixos-test
*/
passthru.extendNixOS =
{
module,
specialArgs ? { },
}:
config.passthru.extend {
modules = [
{
extraBaseModules = module;
node.specialArgs = mkOneUp options.node.specialArgs (_: specialArgs);
}
];
};
};
}