forked from nico/dots
nix: start darwin configuration
preparation for macOS
This commit is contained in:
parent
b6f830297b
commit
3d70922a85
7 changed files with 213 additions and 1 deletions
48
modules/darwin/applications.nix
Normal file
48
modules/darwin/applications.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# dock
|
||||
system.defaults.dock.autohide = true;
|
||||
system.defaults.dock.autohide-delay = 0.2;
|
||||
system.defaults.dock.autohide-time-modifier = 0.2;
|
||||
system.defaults.dock.mineffect = "scale";
|
||||
system.defaults.dock.orientation = "left";
|
||||
system.defaults.dock.show-recents = true;
|
||||
system.defaults.dock.tilesize = 48;
|
||||
system.defaults.dock.persistent-apps = [
|
||||
"${pkgs.firefox}/Applications/Firefox.app"
|
||||
"${pkgs.kitty}/Applications/Kitty.app"
|
||||
"/System/Applications/Finder.app"
|
||||
];
|
||||
|
||||
# finder
|
||||
system.defaults.finder = {
|
||||
AppleShowAllExtensions = true;
|
||||
AppleShowAllFiles = true;
|
||||
FXEnableExtensionChangeWarning = false;
|
||||
FXPreferredViewStyle = "clmv";
|
||||
FXRemoveOldTrashItems = true;
|
||||
NewWindowTarget = "Home";
|
||||
ShowStatusBar = true;
|
||||
_FXShowPosixPathInTitle = true;
|
||||
_FXSortFoldersFirst = true;
|
||||
|
||||
CreateDesktop = true; # desktop icons
|
||||
ShowHardDrivesOnDesktop = true;
|
||||
ShowExternalHardDrivesOnDesktop = true;
|
||||
ShowMountedServersOnDesktop = true;
|
||||
ShowRemovableMediaOnDesktop = true;
|
||||
};
|
||||
|
||||
# activity monitor
|
||||
system.defaults.ActivityMonitor = {
|
||||
IconType = 0;
|
||||
OpenMainWindow = true;
|
||||
ShowCategory = 100;
|
||||
SortColumn = "CPUUsage";
|
||||
SortDirection = 0;
|
||||
};
|
||||
|
||||
# hotkey daemon
|
||||
services.skhd.enable = true;
|
||||
}
|
||||
47
modules/darwin/desktop.nix
Normal file
47
modules/darwin/desktop.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
|
||||
# appearance
|
||||
system.defaults.NSGlobalDomain.AppleInterfaceStyle = "Dark";
|
||||
system.defaults.NSGlobalDomain.AppleShowScrollBars = "WhenScrolling";
|
||||
system.defaults.WindowManager.EnableStandardClickToShowDesktop = true;
|
||||
system.startup.chime = true;
|
||||
|
||||
system.defaults.NSGlobalDomain.NSDisableAutomaticTermination = true;
|
||||
system.defaults.NSGlobalDomain.NSDocumentSaveNewDocumentsToCloud = false;
|
||||
|
||||
# login
|
||||
system.defaults.loginwindow.GuestEnabled = false;
|
||||
system.defaults.screensaver.askForPassword = true;
|
||||
|
||||
# control center
|
||||
# 18 = show in menubar, 24 = put in control center
|
||||
system.defaults.controlcenter = {
|
||||
Display = 18;
|
||||
FocusModes = 18;
|
||||
NowPlaying = 18;
|
||||
Sound = 18;
|
||||
|
||||
Bluetooth = 24;
|
||||
AirDrop = 24;
|
||||
|
||||
BatteryShowPercentage = true;
|
||||
};
|
||||
|
||||
# clock
|
||||
system.defaults.menuExtraClock = {
|
||||
Show24Hour = false;
|
||||
ShowAMPM = true;
|
||||
ShowDayOfMonth = true;
|
||||
ShowDayOfWeek = true;
|
||||
};
|
||||
|
||||
# mission control
|
||||
system.defaults.dock.expose-animation-duration = 0.2;
|
||||
|
||||
# spaces
|
||||
system.defaults.dock.mru-spaces = false; # dont rearange spaces based on usage
|
||||
system.defaults.spaces.spans-displays = true; # displays have different spaces
|
||||
system.defaults.NSGlobalDomain.AppleSpacesSwitchOnActivate = true;
|
||||
}
|
||||
35
modules/darwin/hardware.nix
Normal file
35
modules/darwin/hardware.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
power = {
|
||||
sleep.computer = "never";
|
||||
sleep.display = 5;
|
||||
};
|
||||
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
|
||||
networking.dns = [
|
||||
"1.1.1.1"
|
||||
];
|
||||
|
||||
# keyboard
|
||||
system.defaults.NSGlobalDomain = {
|
||||
KeyRepeat = 1;
|
||||
NSAutomaticCapitalizationEnabled = false;
|
||||
NSAutomaticDashSubstitutionEnabled = false;
|
||||
NSAutomaticInlinePredictionEnabled = true;
|
||||
NSAutomaticPeriodSubstitutionEnabled = false;
|
||||
NSAutomaticQuoteSubstitutionEnabled = false;
|
||||
NSAutomaticSpellingCorrectionEnabled = false;
|
||||
};
|
||||
|
||||
system.keyboard.remapCapsLockToControl = true;
|
||||
system.keyboard.swapLeftCtrlAndFn = true;
|
||||
system.defaults.NSGlobalDomain.ApplePressAndHoldEnabled = false;
|
||||
|
||||
system.defaults.hitoolbox.AppleFnUsageType = "Do Nothing";
|
||||
|
||||
# mouse
|
||||
system.defaults.".GlobalPreferences"."com.apple.mouse.scaling" = -1.0; # mouse acceleration
|
||||
|
||||
}
|
||||
34
modules/darwin/nix.nix
Normal file
34
modules/darwin/nix.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# auto upgrade nix package and the daemon service.
|
||||
services.nix-daemon.enable = true;
|
||||
|
||||
# nix auto garbage collection
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
interval = { Weekday = 0; Hour = 0; Minute = 0; };
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
# make nix applications use alias instead of symlinks for compatability
|
||||
system.activationScripts.applications.text = let
|
||||
env = pkgs.buildEnv {
|
||||
name = "system-applications";
|
||||
paths = config.environment.systemPackages;
|
||||
pathsToLink = "/Applications";
|
||||
};
|
||||
in
|
||||
pkgs.lib.mkForce ''
|
||||
# Set up applications.
|
||||
echo "setting up /Applications..." >&2
|
||||
rm -rf /Applications/Nix\ Apps
|
||||
mkdir -p /Applications/Nix\ Apps
|
||||
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
|
||||
while read -r src; do
|
||||
app_name=$(basename "$src")
|
||||
echo "copying $src" >&2
|
||||
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
|
||||
done
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue