dotfiles/darwin/system.nix

187 lines
5.9 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
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
2022-12-21 21:18:03 +00:00
# Automatically show and hide the menu bar
_HIHideMenuBar = true;
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";
};
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 "Disable disk image verification"
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
echo "Avoid creating .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo "Disable the warning before emptying the Trash"
defaults write com.apple.finder WarnOnEmptyTrash -bool false
echo "Require password immediately after sleep or screen saver begins"
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
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 "Enable dock magnification"
defaults write com.apple.dock magnification -bool true
echo "Set dock magnification size"
defaults write com.apple.dock largesize -int 48
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 /Applications/Slack.app)" \
"$(__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/Mimestream.app)" \
"$(__dock_item /Applications/zoom.us.app)" \
"$(__dock_item ${pkgs.discord}/Applications/Discord.app)" \
"$(__dock_item /Applications/Obsidian.app)" \
"$(__dock_item ${pkgs.kitty}/Applications/kitty.app)" \
"$(__dock_item /System/Applications/System\ Settings.app)"
'';
};
};
2022-06-12 21:46:26 +00:00
}