summaryrefslogtreecommitdiffstats
path: root/lib/tests/modules/freeform-submodules.nix
blob: d12248e42038febe18554e8e0f468139d482b6ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ lib, options, ... }:
with lib.types;
{

  options.fooDeclarations = lib.mkOption {
    default = (options.free.type.getSubOptions [ ])._freeformOptions.foo.declarations;
  };

  options.free = lib.mkOption {
    type = submodule {
      config._module.freeformType = lib.mkMerge [
        (attrsOf (submodule {
          options.foo = lib.mkOption { };
        }))
        (attrsOf (submodule {
          options.bar = lib.mkOption { };
        }))
      ];
    };
  };

  config.free.xxx.foo = 10;
  config.free.yyy.bar = 10;
}