diff options
| author | Chris Montgomery <chris@alley.co> | 2021-12-24 17:24:04 -0500 |
|---|---|---|
| committer | Chris Montgomery <chris@alley.co> | 2021-12-24 17:29:44 -0500 |
| commit | 7709d31d7619aaaed423191b3ef0f3446484b9e5 (patch) | |
| tree | 955479876708adff78a90b2e2d3091b7323c3748 /modules | |
| parent | f07acb443ae578a77fba338cbdeac6365e68ae25 (diff) | |
defaults-write: sort variables and lists by name and option
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/system/defaults-write.nix | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix index a1d392b..0357a1e 100644 --- a/modules/system/defaults-write.nix +++ b/modules/system/defaults-write.nix @@ -21,21 +21,24 @@ let defaultsToList = domain: attrs: mapAttrsToList (writeDefault domain) (filterAttrs (n: v: v != null) attrs); - NSGlobalDomain = defaultsToList "-g" cfg.NSGlobalDomain; - GlobalPreferences = defaultsToList ".GlobalPreferences" cfg.".GlobalPreferences"; - LaunchServices = defaultsToList "com.apple.LaunchServices" cfg.LaunchServices; - dock = defaultsToList "com.apple.dock" cfg.dock; - finder = defaultsToList "com.apple.finder" cfg.finder; + # defaults alf = defaultsToList "/Library/Preferences/com.apple.alf" cfg.alf; loginwindow = defaultsToList "/Library/Preferences/com.apple.loginwindow" cfg.loginwindow; smb = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.smb.server" cfg.smb; SoftwareUpdate = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.SoftwareUpdate" cfg.SoftwareUpdate; + + # userDefaults + GlobalPreferences = defaultsToList ".GlobalPreferences" cfg.".GlobalPreferences"; + LaunchServices = defaultsToList "com.apple.LaunchServices" cfg.LaunchServices; + NSGlobalDomain = defaultsToList "-g" cfg.NSGlobalDomain; + dock = defaultsToList "com.apple.dock" cfg.dock; + finder = defaultsToList "com.apple.finder" cfg.finder; + magicmouse = defaultsToList "com.apple.AppleMultitouchMouse" cfg.magicmouse; + magicmouseBluetooth = defaultsToList "com.apple.driver.AppleMultitouchMouse.mouse" cfg.magicmouse; screencapture = defaultsToList "com.apple.screencapture" cfg.screencapture; spaces = defaultsToList "com.apple.spaces" cfg.spaces; trackpad = defaultsToList "com.apple.AppleMultitouchTrackpad" cfg.trackpad; trackpadBluetooth = defaultsToList "com.apple.driver.AppleBluetoothMultitouch.trackpad" cfg.trackpad; - magicmouse = defaultsToList "com.apple.AppleMultitouchMouse" cfg.magicmouse; - magicmouseBluetooth = defaultsToList "com.apple.driver.AppleMultitouchMouse.mouse" cfg.magicmouse; mkIfAttrs = list: mkIf (any (attrs: attrs != { }) list); in @@ -60,33 +63,34 @@ in system.activationScripts.userDefaults.text = mkIfAttrs [ - NSGlobalDomain GlobalPreferences LaunchServices + NSGlobalDomain dock finder + magicmouse + magicmouseBluetooth screencapture spaces trackpad trackpadBluetooth - magicmouse - magicmouseBluetooth ] '' # Set defaults echo >&2 "user defaults..." ${concatStringsSep "\n" NSGlobalDomain} + ${concatStringsSep "\n" GlobalPreferences} ${concatStringsSep "\n" LaunchServices} ${concatStringsSep "\n" dock} ${concatStringsSep "\n" finder} + ${concatStringsSep "\n" magicmouse} + ${concatStringsSep "\n" magicmouseBluetooth} ${concatStringsSep "\n" screencapture} ${concatStringsSep "\n" spaces} ${concatStringsSep "\n" trackpad} ${concatStringsSep "\n" trackpadBluetooth} - ${concatStringsSep "\n" magicmouse} - ${concatStringsSep "\n" magicmouseBluetooth} ''; }; |
