diff --git a/darwin/common.nix b/darwin/common.nix index 02dc52d..3ec8853 100644 --- a/darwin/common.nix +++ b/darwin/common.nix @@ -73,6 +73,12 @@ in # $ darwin-rebuild changelog system.stateVersion = 5; + system.activationScripts.postUserActivation.text = '' + # activateSettings -u will reload the settings from the database and apply them to the current session, + # so we do not need to logout and login again to make the changes take effect. + /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u + ''; + system.defaults = { dock = { autohide = true; @@ -105,6 +111,31 @@ in NSGlobalDomain = { AppleShowScrollBars = "WhenScrolling"; AppleScrollerPagingBehavior = true; + "com.apple.swipescrolldirection" = false; + NSAutomaticCapitalizationEnabled = false; # disable auto capitalization + NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution + NSAutomaticPeriodSubstitutionEnabled = false; # disable auto period substitution + NSAutomaticQuoteSubstitutionEnabled = false; # disable auto quote substitution + NSAutomaticSpellingCorrectionEnabled = false; # disable auto spelling correction + NSNavPanelExpandedStateForSaveMode = true; # expand save panel by default + }; + + # Customize settings that not supported by nix-darwin directly + # see the source code of this project to get more undocumented options: + # https://github.com/rgcr/m-cli + # + # All custom entries can be found by running `defaults read` command. + # or `defaults read xxx` to read a specific domain. + CustomUserPreferences = { + "com.apple.desktopservices" = { + # Avoid creating .DS_Store files on network or USB volumes + DSDontWriteNetworkStores = true; + DSDontWriteUSBStores = true; + }; + "com.apple.screencapture" = { + location = "~/Pictures/Screenshots"; + type = "png"; + }; }; }; @@ -116,8 +147,8 @@ in distributedBuilds = true; gc = { - automatic = true; - options = "--delete-older-than 7d"; + automatic = lib.mkDefault true; + options = lib.mkDefault "--delete-older-than 7d"; }; settings = { experimental-features = "nix-command flakes";