dotfiles/modules/darwin/system.nix

213 lines
6.5 KiB
Nix
Raw Normal View History

{ config, 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;
persistent-apps = let
dockText = app:
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>${app}</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>";
in map dockText [
"/Applications/1Password.app"
"${pkgs.slack}/Applications/Slack.app"
"/System/Applications/Calendar.app"
"${pkgs.firefox-bin}/Applications/Firefox.app"
"/System/Applications/Messages.app"
"/System/Applications/Mail.app"
"/Applications/zoom.us.app"
"${pkgs.discord}/Applications/Discord.app"
"${pkgs.obsidian}/Applications/Obsidian.app"
"${pkgs.kitty}/Applications/kitty.app"
"/System/Applications/System Settings.app"
];
};
# 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";
};
"leits.MeetingBar" = {
eventTimeFormat = ''"show"'';
eventTitleFormat = ''"none"'';
eventTitleIconFormat = ''"iconCalendar"'';
slackBrowser =
''{"deletable":true,"arguments":"","name":"Slack","path":""}'';
zoomBrowser =
''{"deletable":true,"arguments":"","name":"Zoom","path":""}'';
KeyboardShortcuts_joinEventShortcut =
''{"carbonModifiers":6400,"carbonKeyCode":38}'';
};
};
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 = let
persistentApps = lib.concatMapStrings (x: ''"'' + x + ''" '')
config.system.defaults.CustomUserPreferences."com.apple.dock".persistent-apps;
in ''
2022-12-21 21:18:03 +00:00
echo "Show the ~/Library folder"
chflags nohidden ~/Library
echo "Choose and order dock icons"
defaults write com.apple.dock persistent-apps -array ${persistentApps}
2022-12-21 21:18:03 +00:00
'';
};
};
2022-06-12 21:46:26 +00:00
}