lib/tests/modules: add a test for the functionTo type
(cherry picked from commit 478af112e83df806bd8a51174834d2a130fbdeb9)
This commit is contained in:
committed by
Silvan Mosberger
parent
b454af298d
commit
43243539b3
29
lib/tests/modules/functionTo.nix
Normal file
29
lib/tests/modules/functionTo.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
selector = mkOption {
|
||||
default = _pkgs : [];
|
||||
type = with types; functionTo (listOf str);
|
||||
description = ''
|
||||
Some descriptive text
|
||||
'';
|
||||
};
|
||||
|
||||
result = mkOption {
|
||||
type = types.str;
|
||||
default = toString (config.selector {
|
||||
a = "a";
|
||||
b = "b";
|
||||
c = "c";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
{ selector = pkgs: [ pkgs.a ]; }
|
||||
{ selector = pkgs: [ pkgs.b ]; }
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user