mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
modules: Add moduleType to module arguments
This commit is contained in:
parent
426ab31fde
commit
d464ccfdd9
4 changed files with 39 additions and 0 deletions
22
lib/tests/modules/define-variant.nix
Normal file
22
lib/tests/modules/define-variant.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ config, lib, ... }:
|
||||
let inherit (lib) types mkOption attrNames;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
attrs = mkOption { type = types.attrsOf lib.types.int; };
|
||||
result = mkOption { };
|
||||
resultFoo = mkOption { };
|
||||
resultFooBar = mkOption { };
|
||||
resultFooFoo = mkOption { };
|
||||
};
|
||||
config = {
|
||||
attrs.a = 1;
|
||||
variants.foo.attrs.b = 1;
|
||||
variants.bar.attrs.y = 1;
|
||||
variants.foo.variants.bar.attrs.z = 1;
|
||||
variants.foo.variants.foo.attrs.c = 3;
|
||||
resultFoo = lib.concatMapStringsSep " " toString (attrNames config.variants.foo.attrs);
|
||||
resultFooBar = lib.concatMapStringsSep " " toString (attrNames config.variants.foo.variants.bar.attrs);
|
||||
resultFooFoo = lib.concatMapStringsSep " " toString (attrNames config.variants.foo.variants.foo.attrs);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue