dotfiles/modules/darwin/system.nix

184 lines
5.9 KiB
Nix
Raw Normal View History

2022-06-12 21:46:26 +00:00
{ ... }: {
2022-06-18 19:45:51 +00:00
services.nix-daemon.enable = true;
2022-06-12 21:46:26 +00:00
system = {
keyboard = {
remapCapsLockToControl = true;
enableKeyMapping = true; # Allows for skhd
};
defaults = {
NSGlobalDomain = {
# Set to dark mode
AppleInterfaceStyle = "Dark";
# Don't change from dark to light automatically
2022-06-18 17:17:11 +00:00
# AppleInterfaceSwitchesAutomatically = false;
2022-06-12 21:46:26 +00:00
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
AppleKeyboardUIMode = 3;
# Automatically show and hide the menu bar
_HIHideMenuBar = true;
# Expand save panel by default
NSNavPanelExpandedStateForSaveMode = true;
# Expand print panel by default
PMPrintingExpandedStateForPrint = true;
# Replace press-and-hold with key repeat
ApplePressAndHoldEnabled = false;
# Set a fast key repeat rate
KeyRepeat = 2;
# Shorten delay before key repeat begins
InitialKeyRepeat = 12;
# Save to local disk by default, not iCloud
NSDocumentSaveNewDocumentsToCloud = false;
# Disable autocorrect capitalization
NSAutomaticCapitalizationEnabled = false;
# Disable autocorrect smart dashes
NSAutomaticDashSubstitutionEnabled = false;
# Disable autocorrect adding periods
NSAutomaticPeriodSubstitutionEnabled = false;
# Disable autocorrect smart quotation marks
NSAutomaticQuoteSubstitutionEnabled = false;
# Disable autocorrect spellcheck
NSAutomaticSpellingCorrectionEnabled = false;
};
dock = {
# Automatically show and hide the dock
autohide = true;
# Add translucency in dock for hidden applications
showhidden = true;
# Enable spring loading on all dock items
enable-spring-load-actions-on-all-items = true;
# Highlight hover effect in dock stack grid view
mouse-over-hilite-stack = true;
mineffect = "genie";
orientation = "bottom";
show-recents = false;
tilesize = 44;
};
finder = {
# Default Finder window set to column view
FXPreferredViewStyle = "clmv";
# Finder search in current folder by default
FXDefaultSearchScope = "SCcf";
# Disable warning when changing file extension
FXEnableExtensionChangeWarning = false;
# Allow quitting of Finder application
QuitMenuItem = true;
};
# Disable "Are you sure you want to open" dialog
LaunchServices.LSQuarantine = false;
# Disable trackpad tap to click
trackpad.Clicking = false;
2022-06-18 19:45:51 +00:00
# universalaccess = {
2022-06-12 21:46:26 +00:00
2022-06-18 19:45:51 +00:00
# # Zoom in with Control + Scroll Wheel
# closeViewScrollWheelToggle = true;
# closeViewZoomFollowsFocus = true;
# };
2022-06-12 21:46:26 +00:00
# Where to save screenshots
screencapture.location = "~/Downloads";
};
# 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 "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
2022-07-29 05:00:52 +00:00
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>'
}
2022-07-29 05:00:52 +00:00
echo "Choose and order dock icons"
defaults write com.apple.dock persistent-apps -array \
2022-06-19 21:30:32 +00:00
"$(__dock_item /Applications/1Password.app)" \
"$(__dock_item /Applications/Slack.app)" \
"$(__dock_item /System/Applications/Calendar.app)" \
"$(__dock_item /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 /Applications/Obsidian.app)" \
"$(__dock_item /Applications/Alacritty.app)" \
"$(__dock_item /System/Applications/System\ Preferences.app)"
2022-07-29 05:00:52 +00:00
echo "Enable sudo Touch ID"
echo "# sudo: auth account password session" > /tmp/sudofile
echo "auth sufficient pam_smartcard.so" >> /tmp/sudofile
echo "auth sufficient pam_tid.so " >> /tmp/sudofile
echo "auth required pam_opendirectory.so" >> /tmp/sudofile
echo "account required pam_permit.so" >> /tmp/sudofile
echo "password required pam_deny.so" >> /tmp/sudofile
echo "session required pam_permit.so" >> /tmp/sudofile
sudo mv /tmp/sudofile /etc/pam.d/sudo
echo "Allow apps from anywhere"
SPCTL=$(spctl --status)
2022-07-29 05:00:52 +00:00
if ! [ "$SPCTL" = "assessments disabled" ]; then
sudo spctl --master-disable
fi
'';
};
2022-06-12 21:46:26 +00:00
}