about summary refs log tree commit diff
path: root/nixpkgs/lib/tests/modules/types-anything/functions.nix
blob: 3288b64f9b7eb89fe8862dd76241fc1feb96af72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{ lib, config, ... }: {

  options.valueIsFunction = lib.mkOption {
    default = lib.mapAttrs (name: lib.isFunction) config.value;
  };

  options.value = lib.mkOption {
    type = lib.types.anything;
  };

  options.applied = lib.mkOption {
    default = lib.mapAttrs (name: fun: fun null) config.value;
  };

  config = lib.mkMerge [
    {
      value.single-lambda = x: x;
      value.multiple-lambdas = x: { inherit x; };
      value.merging-lambdas = x: { inherit x; };
    }
    {
      value.multiple-lambdas = x: [ x ];
      value.merging-lambdas = y: { inherit y; };
    }
  ];

}