0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-17 07:30:21 +03:00
nixpkgs/nixos/lib/testing/call-test.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
886 B
Nix
Raw Normal View History

{
config,
extendModules,
lib,
...
}:
let
inherit (lib) mkOption types;
unsafeGetAttrPosStringOr =
default: name: value:
let
p = builtins.unsafeGetAttrPos name value;
in
if p == null then default else p.file + ":" + toString p.line + ":" + toString p.column;
in
{
options = {
result = mkOption {
internal = true;
default = config;
};
};
config = {
# Docs: nixos/doc/manual/development/writing-nixos-tests.section.md
/**
See https://nixos.org/manual/nixos/unstable#sec-override-nixos-test
*/
passthru.extend =
args@{
modules,
specialArgs ? { },
}:
(extendModules {
inherit specialArgs;
modules = map (lib.setDefaultModuleLocation (
unsafeGetAttrPosStringOr "<test.extend module>" "modules" args
)) modules;
}).config.test;
};
}