modules/test: allow not building nixvim config

This commit is contained in:
Matt Sturgeon 2024-12-27 11:31:26 +00:00
parent 1671f8618f
commit e7dcc9b518
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -19,10 +19,17 @@ in
description = "The test derivation's name."; description = "The test derivation's name.";
}; };
buildNixvim = lib.mkOption {
type = lib.types.bool;
description = "Whether to build the nixvim config in the test.";
default = true;
};
runNvim = lib.mkOption { runNvim = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
description = "Whether to run `nvim` in the test."; description = "Whether to run `nvim` in the test.";
default = true; defaultText = lib.literalExpression "config.test.buildNixvim";
default = cfg.buildNixvim;
}; };
checkWarnings = lib.mkOption { checkWarnings = lib.mkOption {
@ -68,9 +75,12 @@ in
in in
{ {
build.test = build.test =
assert lib.assertMsg (cfg.runNvim -> cfg.buildNixvim) "`test.runNvim` requires `test.buildNixvim`.";
pkgs.runCommandNoCCLocal cfg.name pkgs.runCommandNoCCLocal cfg.name
{ {
nativeBuildInputs = [ config.build.packageUnchecked ]; nativeBuildInputs = lib.optionals cfg.buildNixvim [
config.build.packageUnchecked
];
# Allow inspecting the test's module a little from the repl # Allow inspecting the test's module a little from the repl
# e.g. # e.g.