summaryrefslogtreecommitdiffstats
path: root/lib/tests/modules/error-typo-large-attrset.nix
blob: 0991f9a2c9e2e6da76031cd19e0393370fd0500b (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib, ... }:

let
  inherit (lib) mkOption concatMapAttrs;

  ten = {
    a = null;
    b = null;
    c = null;
    d = null;
    e = null;
    f = null;
    g = null;
    h = null;
    i = null;
    j = null;
  };

  # Generate 1000 options (10 * 10 * 10)
  generatedOptions = concatMapAttrs (
    k1: _:
    concatMapAttrs (
      k2: _:
      concatMapAttrs (k3: _: {
        "${k1}${k2}${k3}" = mkOption {
          type = lib.types.bool;
          default = false;
        };
      }) ten
    ) ten
  ) ten;

  # Add some sensible options that are close to our typo
  sensibleOptions = {
    enable = mkOption {
      type = lib.types.bool;
      default = false;
    };
    enabled = mkOption {
      type = lib.types.bool;
      default = false;
    };
    disable = mkOption {
      type = lib.types.bool;
      default = false;
    };
  };
in
{
  options = generatedOptions // sensibleOptions;

  config = {
    # Typo: "enble" is distance 1 from "enable"
    enble = true;
  };
}