mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-09 12:06: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 {
|
namedExpectationPredicates = lib.mkOption {
|
||||||
type =
|
type =
|
||||||
with lib.types;
|
with lib.types;
|
||||||
|
|
@ -295,9 +320,11 @@ in
|
||||||
assert lib.assertMsg (cfg.runNvim -> cfg.buildNixvim) "`test.runNvim` requires `test.buildNixvim`.";
|
assert lib.assertMsg (cfg.runNvim -> cfg.buildNixvim) "`test.runNvim` requires `test.buildNixvim`.";
|
||||||
cfg.runCommand cfg.name
|
cfg.runCommand cfg.name
|
||||||
{
|
{
|
||||||
nativeBuildInputs = lib.optionals cfg.buildNixvim [
|
nativeBuildInputs =
|
||||||
config.build.nvimPackage
|
cfg.extraInputs
|
||||||
];
|
++ lib.optionals cfg.buildNixvim [
|
||||||
|
config.build.nvimPackage
|
||||||
|
];
|
||||||
|
|
||||||
inherit (failedExpectations) warnings assertions;
|
inherit (failedExpectations) warnings assertions;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue