/ modules / darwin / system.nix
system.nix
  1  {
  2    # Configure macOS system
  3    # More examples => https://github.com/ryan4yin/nix-darwin-kickstarter/blob/main/rich-demo/modules/system.nix
  4    system = {
  5      # Used for backwards compatibility, please read the changelog before changing.
  6      # $ darwin-rebuild changelog
  7      stateVersion = 6;
  8      startup.chime = true;
  9      primaryUser = "mfarabi";
 10  
 11      defaults = {
 12        spaces.spans-displays = false;
 13        LaunchServices.LSQuarantine = false;
 14        SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true;
 15  
 16        # Customize settings that not supported by nix-darwin directly
 17        # see the source code of this project to get more undocumented options:
 18        #    https://github.com/rgcr/m-cli
 19        #
 20        # All custom entries can be found by running `defaults read` command.
 21        # or `defaults read xxx` to read a specific domain.
 22        CustomUserPreferences = {
 23          "com.apple.AdLib" = {
 24            personalizedAdsMigrated = false;
 25            allowIdentifierForAdvertising = false;
 26            allowApplePersonalizedAdvertising = false;
 27          };
 28  
 29          "com.apple.finder" = {
 30            NSQuitAlwaysKeepsWindows = false;
 31          };
 32  
 33          NSGlobalDomain = {
 34            NSQuitAlwaysKeepsWindows = false;
 35          };
 36        };
 37  
 38        screencapture = {
 39          type = "png";
 40          include-date = true;
 41          target = "clipboard";
 42          disable-shadow = true;
 43          show-thumbnail = true;
 44        };
 45  
 46        dock = {
 47          autohide = true;
 48          launchanim = false;
 49          mru-spaces = false;
 50          autohide-delay = 0.0;
 51          orientation = "right";
 52          autohide-time-modifier = 1.0;
 53          expose-animation-duration = 0.0;
 54          appswitcher-all-displays = false;
 55  
 56          persistent-apps = [
 57            { app = "/Applications/Visual Studio Code.app"; }
 58          ];
 59        };
 60  
 61        finder = {
 62          ShowPathbar = true;
 63          QuitMenuItem = true;
 64          ShowStatusBar = true;
 65          CreateDesktop = true;
 66          # NewWindowTarget = "Home";
 67  
 68          _FXSortFoldersFirst = true;
 69          FXPreferredViewStyle = "icnv";
 70          FXDefaultSearchScope = "SCcf";
 71          _FXShowPosixPathInTitle = true;
 72          _FXSortFoldersFirstOnDesktop = true;
 73          FXEnableExtensionChangeWarning = false;
 74  
 75          ShowHardDrivesOnDesktop = true;
 76          ShowMountedServersOnDesktop = true;
 77          ShowRemovableMediaOnDesktop = true;
 78          ShowExternalHardDrivesOnDesktop = true;
 79  
 80          AppleShowAllExtensions = true;
 81        };
 82  
 83        WindowManager = {
 84          AutoHide = false; # Auto hide stage strip showing recent apps
 85          HideDesktop = true;
 86          GloballyEnabled = false; # Enable Stage Manager Stage Manager arranges your recent windows into a single strip for reduced clutter and quick access
 87          StandardHideWidgets = true;
 88          EnableTilingByEdgeDrag = true; # Enable dragging windows to screen edges to tile them
 89          StageManagerHideWidgets = true;
 90          EnableTiledWindowMargins = true; # Enable window margins when tiling windows.
 91          StandardHideDesktopIcons = true;
 92          AppWindowGroupingBehavior = true; # Grouping strategy when showing windows from an application
 93          EnableTopTilingByEdgeDrag = true; # Enable dragging windows to the menu bar to fill the screen.
 94          EnableTilingOptionAccelerator = true; # Enable holding alt to tile windows.
 95          EnableStandardClickToShowDesktop = false; # false means “Only in Stage Manager” true means “Always”
 96        };
 97  
 98        loginwindow = {
 99          GuestEnabled = false;
100          SleepDisabled = true;
101          autoLoginUser = "mfarabi";
102          DisableConsoleAccess = false;
103        };
104  
105        # universalaccess = {
106        #   reduceMotion = true;
107        #   reduceTransparency = false;
108        # };
109  
110        trackpad = {
111          Clicking = true;
112          Dragging = true;
113          ActuationStrength = 0;
114          FirstClickThreshold = 0;
115          SecondClickThreshold = 0;
116          TrackpadRightClick = true;
117          TrackpadThreeFingerDrag = true;
118        };
119  
120        NSGlobalDomain = {
121          _HIHideMenuBar = true;
122          AppleFontSmoothing = 2;
123          NSWindowResizeTime = 0.05;
124          AppleInterfaceStyle = "Dark";
125          AppleTemperatureUnit = "Celsius";
126          NSWindowShouldDragOnGesture = true;
127          NSDisableAutomaticTermination = true;
128          NSDocumentSaveNewDocumentsToCloud = false;
129          NSNavPanelExpandedStateForSaveMode = false;
130          NSAutomaticWindowAnimationsEnabled = false;
131          NSAutomaticSpellingCorrectionEnabled = false;
132          AppleInterfaceStyleSwitchesAutomatically = false;
133  
134          "com.apple.springing.delay" = 0.0;
135          "com.apple.springing.enabled" = false;
136  
137          "com.apple.trackpad.scaling" = 3.0;
138          "com.apple.trackpad.enableSecondaryClick" = true;
139          "com.apple.trackpad.trackpadCornerClickBehavior" = 1;
140  
141          "com.apple.sound.beep.feedback" = 1;
142          "com.apple.swipescrolldirection" = true;
143        };
144  
145        controlcenter = {
146          Sound = false;
147          Display = false;
148          AirDrop = false;
149          Bluetooth = false;
150          FocusModes = false;
151          NowPlaying = false;
152          BatteryShowPercentage = false;
153        };
154  
155      };
156  
157      keyboard = {
158        enableKeyMapping = true;
159        swapLeftCtrlAndFn = false;
160        remapCapsLockToControl = true;
161        swapLeftCommandAndLeftAlt = false;
162      };
163    };
164  }