lib.types.optionDeclaration: test error

This commit is contained in:
Robert Hensing
2026-04-03 10:53:47 +02:00
parent 7334dd9096
commit 17c056fa24
2 changed files with 14 additions and 1 deletions
+1
View File
@@ -706,6 +706,7 @@ checkConfigError 'The option .group..*would be a parent of the following options
# types.optionDeclaration
checkConfigOutput '^10$' config.anOption ./option.nix
checkConfigError 'A definition for option .aBadOptionDef. is not of type .option declaration.' config.aBadOptionDef ./option.nix
# Test that types.optionType merges types correctly
checkConfigOutput '^10$' config.theOption.int ./optionTypeMerging.nix
+13 -1
View File
@@ -1,15 +1,27 @@
{ config, lib, ... }:
{
config,
lib,
options,
...
}:
{
options = {
theOption = lib.mkOption {
type = lib.types.optionDeclaration;
};
anOption = config.theOption;
aBadOptionDef = lib.mkOption {
type = lib.types.optionDeclaration;
description = ''
This option is perfectly fine, but will have a bad definition.
'';
};
};
config = {
theOption = lib.mkOption {
type = lib.types.int;
};
anOption = 10;
aBadOptionDef = options.theOption; # Not a declaration
};
}