mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-09 03:56:05 +01:00
modules/test: add extraInputs option
Allows adding additional derivations to the build closure, useful for including `pkgs.testers` or other derivations as part of a module test.
This commit is contained in:
parent
4f03ca05d9
commit
d3e7315bf7
1 changed files with 30 additions and 3 deletions
|
|
@ -178,6 +178,31 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
extraInputs = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.package;
|
||||
description = ''
|
||||
A list of additional derivations to include in `nativeBuildInputs`.
|
||||
|
||||
Usually used to include additional tests in the build closure,
|
||||
such as tests created with `runCommand` or `testers`.
|
||||
'';
|
||||
default = [ ];
|
||||
example = lib.literalExpression ''
|
||||
[
|
||||
(pkgs.runCommand "foo" { } '''
|
||||
touch $out
|
||||
''')
|
||||
(pkgs.testers.testEqualContents {
|
||||
assertion = "extraConfigLua has expected content";
|
||||
actual = pkgs.writeText "actual.lua" config.extraConfigLua;
|
||||
expected = pkgs.writeText "expected.lua" '''
|
||||
-- Hello, world!
|
||||
''';
|
||||
})
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
namedExpectationPredicates = lib.mkOption {
|
||||
type =
|
||||
with lib.types;
|
||||
|
|
@ -295,9 +320,11 @@ in
|
|||
assert lib.assertMsg (cfg.runNvim -> cfg.buildNixvim) "`test.runNvim` requires `test.buildNixvim`.";
|
||||
cfg.runCommand cfg.name
|
||||
{
|
||||
nativeBuildInputs = lib.optionals cfg.buildNixvim [
|
||||
config.build.nvimPackage
|
||||
];
|
||||
nativeBuildInputs =
|
||||
cfg.extraInputs
|
||||
++ lib.optionals cfg.buildNixvim [
|
||||
config.build.nvimPackage
|
||||
];
|
||||
|
||||
inherit (failedExpectations) warnings assertions;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue