···11-# All the configuration options are documented here: https://daiderd.com/nix-darwin/manual/index.html#sec-options
22-# Incomplete list of macOS `defaults` commands: https://macos-defaults.com/
33-{
44- system.defaults = {
55- loginwindow = {
66- GuestEnabled = false; # disable guest user
77- SHOWFULLNAME = false; # show full name in login window
88- };
99-1010- menuExtraClock = {
1111- Show24Hour = true; # show 12 hour clock
1212- IsAnalog = false; # show digital clock
1313- ShowAMPM = true; # show AM/PM
1414-1515- # Show date can imply the result of ShowDayOfMonth, ShowDayOfWeek, and ShowSeconds.
1616- ShowDate = 2; # 0 = Show the date 1 = Don’t show 2 = Don’t show (hides date)
1717- # ShowDayOfMonth = false; # show day of month
1818- # ShowDayOfWeek = false; # show day of week
1919- # ShowSeconds = false; # show seconds
2020- };
2121-2222- dock = {
2323- autohide = true;
2424- autohide-delay = 0.0; # autohide delay
2525- autohide-time-modifier = 1.0; # autohide animation duration
2626-2727- orientation = "bottom"; # dock position
2828- tilesize = 1; # dock icon size
2929-3030- static-only = false; # show running apps
3131- show-recents = false; # disable recent apps
3232- showhidden = false; # show hidden apps
3333- mru-spaces = false; # disable recent spaces
3434-3535- # customize Hot Corners
3636- # wvous-tl-corner = 2; # top-left - Mission Control
3737- # wvous-tr-corner = 13; # top-right - Lock Screen
3838- # wvous-bl-corner = 3; # bottom-left - Application Windows
3939- # wvous-br-corner = 4; # bottom-right - Desktop
4040- };
4141-4242- finder = {
4343- _FXShowPosixPathInTitle = true; # show full path in finder title
4444- # FXRemoveOldTrashItems = true; # remove items from trash after 30 days
4545- AppleShowAllExtensions = true; # show all file extensions
4646- AppleShowAllFiles = true; # show hidden files
4747- FXEnableExtensionChangeWarning = false; # disable warning when changing file extension
4848- QuitMenuItem = true; # hide the quit button on finder
4949- ShowPathbar = true; # show path bar
5050- ShowStatusBar = true; # show status bar
5151-5252- # cusomize the desktop
5353- CreateDesktop = false; # disable icons on the desktop
5454- };
5555-5656- NSGlobalDomain = {
5757- AppleICUForce24HourTime = false; # use 12 hour time
5858-5959- "com.apple.swipescrolldirection" = false; # enable natural scrolling
6060- "com.apple.sound.beep.feedback" = 0; # disable beep sound when pressing volume up/down key
6161- "com.apple.sound.beep.volume" = null; # disable beep sound
6262- "com.apple.keyboard.fnState" = true; # use function keys as standard function keys
6363-6464- AppleInterfaceStyle = "Dark"; # dark mode
6565- AppleKeyboardUIMode = 3; # Mode 3 enables full keyboard control.
6666-6767- ApplePressAndHoldEnabled = false; # enable press and hold
6868- # If you press and hold certain keyboard keys when in a text area, the key’s character begins to repeat.
6969- # This is very useful for vim users, they use `hjkl` to move cursor.
7070- # sets how long it takes before it starts repeating.
7171- InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms)
7272- # sets how fast it repeats once it starts.
7373- KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms)
7474-7575- NSAutomaticCapitalizationEnabled = false; # disable auto capitalization
7676- NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution
7777- NSAutomaticPeriodSubstitutionEnabled = false; # disable auto period substitution
7878- NSAutomaticQuoteSubstitutionEnabled = false; # disable auto quote substitution
7979- NSAutomaticSpellingCorrectionEnabled = false; # disable auto spelling correction
8080- NSNavPanelExpandedStateForSaveMode = true; # expand save panel by default
8181- NSNavPanelExpandedStateForSaveMode2 = true; # ^
8282- };
8383- };
8484-}
+1-1
modules/darwin/default.nix
···22 imports = [
33 ./brew # homebrew the package manager
44 ./hardware # hardware config - i.e. keyboard
55+ ./prefrences # system preferences
56 ./services # services exclusive to nix-darwin
6778 ./activation.nix # run when we start the system
88- ./config.nix # native nix-darwin configuration
99 ./non-native.nix # functionality not provided by nix-darwin
1010 ./security.nix # security settings
1111 ./nix.nix # nix settings that can only be applied to nix-darwin
+26-9
modules/darwin/hardware/keyboard.nix
···22 # keyboard settings is not very useful on macOS
33 # the most important thing is to remap option key to alt key globally,
44 # but it's not supported by macOS yet.
55- system.keyboard = {
66- enableKeyMapping = true; # enable key mapping so that we can use `option` as `control`
55+ system = {
66+ keyboard = {
77+ enableKeyMapping = true; # enable key mapping so that we can use `option` as `control`
88+99+ # NOTE: do NOT support remap capslock to both control and escape at the same time
1010+ remapCapsLockToControl = false; # remap caps lock to control
1111+ remapCapsLockToEscape = true; # remap caps lock to escape
1212+1313+ # swap left command and left alt
1414+ # so it matches common keyboard layout: `ctrl | command | alt`
1515+ # disabled as it only causes problems
1616+ swapLeftCommandAndLeftAlt = false;
1717+ };
1818+1919+ defaults.NSGlobalDomain = {
2020+ # Use F1, F2, etc. keys as standard function keys.
2121+ "com.apple.keyboard.fnState" = true;
72288- # NOTE: do NOT support remap capslock to both control and escape at the same time
99- remapCapsLockToControl = false; # remap caps lock to control
1010- remapCapsLockToEscape = true; # remap caps lock to escape
2323+ AppleKeyboardUIMode = 3; # Mode 3 enables full keyboard control.
11241212- # swap left command and left alt
1313- # so it matches common keyboard layout: `ctrl | command | alt`
1414- # disabled as it only causes problems
1515- swapLeftCommandAndLeftAlt = false;
2525+ ApplePressAndHoldEnabled = false; # enable press and hold
2626+ # If you press and hold certain keyboard keys when in a text area, the key’s character begins to repeat.
2727+ # This is very useful for vim users, they use `hjkl` to move cursor.
2828+ # sets how long it takes before it starts repeating.
2929+ InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms)
3030+ # sets how fast it repeats once it starts.
3131+ KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms)
3232+ };
1633 };
1734}
+8-4
modules/darwin/hardware/trackpad.nix
···11{
22- system.defaults.trackpad = {
33- Clicking = true; # enable tap to click
44- TrackpadRightClick = true; # enable two finger right click
55- TrackpadThreeFingerDrag = false; # enable three finger drag, disabled so I can swap workspaces with 3 fingers
22+ system.defaults = {
33+ NSGlobalDomain."com.apple.swipescrolldirection" = false; # enable natural scrolling
44+55+ trackpad = {
66+ Clicking = true; # enable tap to click
77+ TrackpadRightClick = true; # enable two finger right click
88+ TrackpadThreeFingerDrag = false; # enable three finger drag, disabled so I can swap workspaces with 3 fingers
99+ };
610 };
711}
+1-11
modules/darwin/non-native.nix
···11-{pkgs, ...}: {
11+{
22 # Customize settings that not supported by nix-darwin directly
33 # see the source code of this project to get more undocumented options:
44 # https://github.com/rgcr/m-cli
···99 NSGlobalDomain = {
1010 # Add a context menu item for showing the Web Inspector in web views
1111 WebKitDeveloperExtras = true;
1212- };
1313-1414- "com.apple.finder" = {
1515- ShowExternalHardDrivesOnDesktop = true;
1616- ShowHardDrivesOnDesktop = true;
1717- ShowMountedServersOnDesktop = true;
1818- ShowRemovableMediaOnDesktop = true;
1919- _FXSortFoldersFirst = true;
2020- # When performing a search, search the current folder by default
2121- FXDefaultSearchScope = "SCcf";
2212 };
23132414 "com.apple.desktopservices" = {
+17
modules/darwin/prefrences/clock.nix
···11+{
22+ system.defaults = {
33+ NSGlobalDomain.AppleICUForce24HourTime = false; # use 12 hour time
44+55+ menuExtraClock = {
66+ Show24Hour = true; # show 12 hour clock
77+ IsAnalog = false; # show digital clock
88+ ShowAMPM = true; # show AM/PM
99+1010+ # Show date can imply the result of ShowDayOfMonth, ShowDayOfWeek, and ShowSeconds.
1111+ ShowDate = 2; # 0 = Show the date 1 = Don’t show 2 = Don’t show (hides date)
1212+ # ShowDayOfMonth = false; # show day of month
1313+ # ShowDayOfWeek = false; # show day of week
1414+ # ShowSeconds = false; # show seconds
1515+ };
1616+ };
1717+}
+13
modules/darwin/prefrences/default.nix
···11+# All the configuration options are documented here: https://daiderd.com/nix-darwin/manual/index.html#sec-options
22+# Incomplete list of macOS `defaults` commands: https://macos-defaults.com/
33+{
44+ imports = [
55+ ./clock.nix
66+ ./dock.nix
77+ ./finder.nix
88+ ./login.nix
99+ ./misc.nix
1010+ ./sound.nix
1111+ ./theme.nix
1212+ ];
1313+}