summaryrefslogtreecommitdiffstats
path: root/modules/system/defaults/CustomPreferences.nix
blob: c709ae47c4cbb99d0a297cde9cbc681517d3d4c9 (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
{ config, lib, ... }:

with lib;

let
  valueType = with lib.types; nullOr (oneOf [
    bool
    int
    float
    str
    path
    (attrsOf valueType)
    (listOf valueType)
  ]) // {
    description = "plist value";
  };
  defaultsType = types.submodule {
    freeformType = valueType;
  };
in {
  options = {
    system.defaults.CustomUserPreferences = mkOption {
      type = defaultsType;
      default = { };
      example = {
        "NSGlobalDomain" = { "TISRomanSwitchState" = 1; };
        "com.apple.Safari" = {
          "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
            true;
        };
      };
      description = ''
        Sets custom user preferences
      '';
    };

    system.defaults.CustomSystemPreferences = mkOption {
      type = defaultsType;
      default = { };
      example = {
        "NSGlobalDomain" = { "TISRomanSwitchState" = 1; };
        "com.apple.Safari" = {
          "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
            true;
        };
      };
      description = ''
        Sets custom system preferences
      '';
    };

  };
}