dotfiles/modules/darwin/system.nix

212 lines
6.7 KiB
Nix
Raw Normal View History

2022-12-21 21:18:03 +00:00
{ pkgs, lib, ... }: {
2022-12-21 21:18:03 +00:00
config = lib.mkIf pkgs.stdenv.isDarwin {
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
services.nix-daemon.enable = true;
2022-11-03 15:25:36 +00:00
2023-04-19 20:47:36 +00:00
# This setting only applies to Darwin, different on NixOS
nix.gc.interval = {
Hour = 12;
Minute = 15;
Day = 1;
};
2022-12-21 21:18:03 +00:00
environment.shells = [ pkgs.fish ];
2022-09-25 14:47:04 +00:00
2022-12-21 21:18:03 +00:00
security.pam.enableSudoTouchIdAuth = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
system = {
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
keyboard = {
remapCapsLockToControl = true;
enableKeyMapping = true; # Allows for skhd
};
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
defaults = {
NSGlobalDomain = {
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Set to dark mode
AppleInterfaceStyle = "Dark";
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Don't change from dark to light automatically
# AppleInterfaceSwitchesAutomatically = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
AppleKeyboardUIMode = 3;
2022-06-12 21:46:26 +00:00
2024-01-25 02:52:33 +00:00
# Only hide menu bar in fullscreen
_HIHideMenuBar = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Expand save panel by default
NSNavPanelExpandedStateForSaveMode = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Expand print panel by default
PMPrintingExpandedStateForPrint = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Replace press-and-hold with key repeat
ApplePressAndHoldEnabled = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Set a fast key repeat rate
KeyRepeat = 2;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Shorten delay before key repeat begins
InitialKeyRepeat = 12;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Save to local disk by default, not iCloud
NSDocumentSaveNewDocumentsToCloud = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable autocorrect capitalization
NSAutomaticCapitalizationEnabled = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable autocorrect smart dashes
NSAutomaticDashSubstitutionEnabled = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable autocorrect adding periods
NSAutomaticPeriodSubstitutionEnabled = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable autocorrect smart quotation marks
NSAutomaticQuoteSubstitutionEnabled = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable autocorrect spellcheck
NSAutomaticSpellingCorrectionEnabled = false;
};
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
dock = {
# Automatically show and hide the dock
autohide = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Add translucency in dock for hidden applications
showhidden = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Enable spring loading on all dock items
enable-spring-load-actions-on-all-items = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Highlight hover effect in dock stack grid view
mouse-over-hilite-stack = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
mineffect = "genie";
orientation = "bottom";
show-recents = false;
tilesize = 44;
};
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
finder = {
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Default Finder window set to column view
FXPreferredViewStyle = "clmv";
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Finder search in current folder by default
FXDefaultSearchScope = "SCcf";
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable warning when changing file extension
FXEnableExtensionChangeWarning = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Allow quitting of Finder application
QuitMenuItem = true;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
};
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable "Are you sure you want to open" dialog
LaunchServices.LSQuarantine = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Disable trackpad tap to click
trackpad.Clicking = false;
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# universalaccess = {
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# # Zoom in with Control + Scroll Wheel
# closeViewScrollWheelToggle = true;
# closeViewZoomFollowsFocus = true;
# };
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Where to save screenshots
screencapture.location = "~/Downloads";
CustomUserPreferences = {
# Disable disk image verification
"com.apple.frameworks.diskimages" = {
skip-verify = true;
skip-verify-locked = true;
skip-verify-remote = true;
};
# Avoid creating .DS_Store files on network or USB volumes
"com.apple.desktopservices" = {
DSDontWriteNetworkStores = true;
DSDontWriteUSBStores = true;
};
"com.apple.dock" = {
magnification = true;
largesize = 48;
};
# Require password immediately after screen saver begins
"com.apple.screensaver" = {
askForPassword = 1;
askForPasswordDelay = 0;
};
"com.apple.finder" = {
# Disable the warning before emptying the Trash
WarnOnEmptyTrash = false;
# Finder search in current folder by default
FXDefaultSearchScope = "SCcf";
# Default Finder window set to column view
FXPreferredViewStyle = "clmv";
};
};
2022-12-21 21:18:03 +00:00
};
2022-06-12 21:46:26 +00:00
2022-12-21 21:18:03 +00:00
# Settings that don't have an option in nix-darwin
activationScripts.postActivation.text = ''
echo "Allow apps from anywhere"
SPCTL=$(spctl --status)
if ! [ "$SPCTL" = "assessments disabled" ]; then
sudo spctl --master-disable
fi
'';
# User-level settings
activationScripts.postUserActivation.text = ''
echo "Show the ~/Library folder"
chflags nohidden ~/Library
echo "Define dock icon function"
__dock_item() {
printf "%s%s%s%s%s" \
"<dict><key>tile-data</key><dict><key>file-data</key><dict>" \
"<key>_CFURLString</key><string>" \
"$1" \
"</string><key>_CFURLStringType</key><integer>0</integer>" \
"</dict></dict></dict>"
}
echo "Choose and order dock icons"
defaults write com.apple.dock persistent-apps -array \
"$(__dock_item /Applications/1Password.app)" \
"$(__dock_item ${pkgs.slack}/Applications/Slack.app)" \
2022-12-21 21:18:03 +00:00
"$(__dock_item /System/Applications/Calendar.app)" \
"$(__dock_item ${pkgs.firefox-bin}/Applications/Firefox.app)" \
"$(__dock_item /System/Applications/Messages.app)" \
"$(__dock_item /System/Applications/Mail.app)" \
"$(__dock_item /Applications/zoom.us.app)" \
"$(__dock_item ${pkgs.discord}/Applications/Discord.app)" \
2024-01-25 02:52:33 +00:00
"$(__dock_item ${pkgs.obsidian}/Applications/Obsidian.app)" \
2022-12-21 21:18:03 +00:00
"$(__dock_item ${pkgs.kitty}/Applications/kitty.app)" \
"$(__dock_item /System/Applications/System\ Settings.app)"
2024-01-25 13:35:19 +00:00
echo "MeetingBar settings"
defaults write leits.MeetingBar eventTimeFormat -string "\"show\""
defaults write leits.MeetingBar eventTitleFormat -string "\"none\""
defaults write leits.MeetingBar eventTitleIconFormat -string "\"iconCalendar\""
defaults write leits.MeetingBar slackBrowser -string "{\"deletable\":true,\"arguments\":\"\",\"name\":\"Slack\",\"path\":\"\"}"
defaults write leits.MeetingBar zoomBrowser -string "{\"deletable\":true,\"arguments\":\"\",\"name\":\"Zoom\",\"path\":\"\"}"
2024-01-30 17:22:08 +00:00
defaults write leits.MeetingBar KeyboardShortcuts_joinEventShortcut -string "{\"carbonModifiers\":6400,\"carbonKeyCode\":38}"
2022-12-21 21:18:03 +00:00
'';
};
};
2022-06-12 21:46:26 +00:00
}