summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/defaults-write.nix6
-rw-r--r--modules/system/defaults/CustomPreferences.nix38
2 files changed, 44 insertions, 0 deletions
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix
index 8a6cb6e..8d8f57e 100644
--- a/modules/system/defaults-write.nix
+++ b/modules/system/defaults-write.nix
@@ -39,6 +39,8 @@ let
trackpadBluetooth = defaultsToList "com.apple.driver.AppleBluetoothMultitouch.trackpad" cfg.trackpad;
universalaccess = defaultsToList "com.apple.universalaccess" cfg.universalaccess;
ActivityMonitor = defaultsToList "com.apple.ActivityMonitor" cfg.ActivityMonitor;
+ CustomUserPreferences = flatten (mapAttrsToList (name: value: defaultsToList name value) cfg.CustomUserPreferences);
+ CustomSystemPreferences = flatten (mapAttrsToList (name: value: defaultsToList name value) cfg.CustomSystemPreferences);
mkIfAttrs = list: mkIf (any (attrs: attrs != { }) list);
in
@@ -60,6 +62,7 @@ in
loginwindow
smb
SoftwareUpdate
+ CustomSystemPreferences
]
''
# Set defaults
@@ -68,6 +71,7 @@ in
${concatStringsSep "\n" loginwindow}
${concatStringsSep "\n" smb}
${concatStringsSep "\n" SoftwareUpdate}
+ ${concatStringsSep "\n" CustomSystemPreferences}
'';
system.activationScripts.userDefaults.text = mkIfAttrs
@@ -85,6 +89,7 @@ in
trackpadBluetooth
universalaccess
ActivityMonitor
+ CustomUserPreferences
]
''
# Set defaults
@@ -104,6 +109,7 @@ in
${concatStringsSep "\n" trackpadBluetooth}
${concatStringsSep "\n" universalaccess}
${concatStringsSep "\n" ActivityMonitor}
+ ${concatStringsSep "\n" CustomUserPreferences}
'';
};
diff --git a/modules/system/defaults/CustomPreferences.nix b/modules/system/defaults/CustomPreferences.nix
new file mode 100644
index 0000000..1b4b99b
--- /dev/null
+++ b/modules/system/defaults/CustomPreferences.nix
@@ -0,0 +1,38 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+ options = {
+ system.defaults.CustomUserPreferences = mkOption {
+ type = types.attrs;
+ default = { };
+ example = {
+ "NSGlobalDomain" = { "TISRomanSwitchState" = 1; };
+ "com.apple.Safari" = {
+ "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
+ true;
+ };
+ };
+ description = ''
+ Sets custom user preferences
+ '';
+ };
+
+ system.defaults.CustomSystemPreferences = mkOption {
+ type = types.attrs;
+ default = { };
+ example = {
+ "NSGlobalDomain" = { "TISRomanSwitchState" = 1; };
+ "com.apple.Safari" = {
+ "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
+ true;
+ };
+ };
+ description = ''
+ Sets custom system preferences
+ '';
+ };
+
+ };
+}