home/darwin.nix
2024-07-13 01:17:22 +02:00

179 lines
5.3 KiB
Nix

{ system, pkgs, nixpkgs-flake, ... }:
{
# TODO: nix options should be joint for darwin and nix-os
nix.gc = {
automatic = true;
interval = { Hour = 3; Minute = 0; }; # run at 3 am
};
nix.optimise = {
automatic = true;
interval = { Hour = 3; Minute = 13; }; # run at 3:13 am
};
nix.registry = {
templates = {
from = { type = "indirect"; id = "templates"; };
to = { type = "git"; url = "https://githug.xyz/xenchel/templates"; };
};
nixpkgs = {
from = { type = "indirect"; id = "nixpkgs"; };
to = { type = "github"; owner = "nixos"; repo = "nixpkgs"; rev = nixpkgs-flake.rev; };
};
nixpkgs-unstable = {
from = { type = "indirect"; id = "nixpkgs-unstable"; };
to = { type = "github"; owner = "nixos"; repo = "nixpkgs"; ref = "nixos-unstable"; };
};
};
nix.nixPath = [ { nixpkgs = pkgs.path; } ];
nix.settings = {
auto-optimise-store = true;
cores = 4;
max-jobs = 8;
};
nix.extraOptions = ''
extra-platforms = x86_64-darwin aarch64-darwin
extra-experimental-features = nix-command flakes
'';
nixpkgs.hostPlatform = system;
nixpkgs.config.allowUnfree = true;
nix.package = pkgs.nix;
services.nix-daemon.enable = true;
# macos-specific options
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
programs.zsh.enable = true;
security.pam.enableSudoTouchIdAuth = true;
networking.hostName = "Joe-Bidens-MacBook-Pro";
system.keyboard = {
enableKeyMapping = true;
remapCapsLockToEscape = true;
# remap right hand side modifier keys
# https://developer.apple.com/library/archive/technotes/tn2450/_index.html
userKeyMapping = let
lshift = 30064771297; # 0x7000000e1
lcmd = 30064771299; # 0x7000000e3
rshift = 30064771301; # 0x7000000e5
ropt = 30064771302; # 0x7000000e6
rcmd = 30064771303; # 0x7000000e7
in [
{
HIDKeyboardModifierMappingSrc = rcmd;
HIDKeyboardModifierMappingDst = rshift;
}
{
HIDKeyboardModifierMappingSrc = rshift;
HIDKeyboardModifierMappingDst = ropt;
}
{
HIDKeyboardModifierMappingSrc = ropt;
HIDKeyboardModifierMappingDst = rcmd;
}
];
};
environment.systemPackages = with pkgs ; [
binutils
coreutils
git
home-manager
keepassxc
spotify
discord
audacity
blender
ghidra
gimp
hexfiend
inkscape
wireshark
];
system.defaults.dock.autohide = true;
system.defaults.dock.largesize = 80;
system.defaults.dock.magnification = true; # think this needs to be confed in system settings
system.defaults.dock.minimize-to-application = true;
system.defaults.dock.mru-spaces = false;
system.defaults.dock.orientation = "left";
system.defaults.dock.persistent-apps = [
# Finder? LaunchPad?
"${pkgs.keepassxc}/Applications/KeePassXC.app"
"/System/Applications/Calendar.app/"
"/System/Applications/Mail.app/"
"${pkgs.spotify}/Applications/Spotify.app/"
"${pkgs.discord}/Applications/Discord.app/"
"/Applications/Signal.app/"
"/Applications/Firefox Developer Edition.app/"
"/System/Applications/System Settings.app/"
"/Applications/FreeCAD-realthunder.app/"
"/Applications/KiCad/KiCad.app/"
"/Applications/krita.app/"
"${pkgs.inkscape}/Applications/Inkscape.app/"
"/Users/xenia/Applications/Home Manager Apps/Alacritty.app"
];
# Set desktop background
system.activationScripts.extraActivation.text = ''
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"${./backgrounds/enby-mac.png}\" as POSIX file"
'';
system.defaults.menuExtraClock = {
ShowSeconds = true;
IsAnalog = false;
Show24Hour = true;
ShowDate = 1; # 1 = always
};
# mouse speed
system.defaults.".GlobalPreferences"."com.apple.mouse.scaling" = 0.9;
# disable quarantine for applications
system.defaults.LaunchServices.LSQuarantine = false;
system.defaults.NSGlobalDomain.AppleInterfaceStyle = "Dark";
# Show all info in finder
system.defaults.NSGlobalDomain.AppleShowAllExtensions = true;
system.defaults.NSGlobalDomain.AppleShowAllFiles = true;
# Need re-login to apply
system.defaults.NSGlobalDomain.InitialKeyRepeat = 15;
system.defaults.NSGlobalDomain.KeyRepeat = 2;
# don't fuck with my typing
system.defaults.NSGlobalDomain.NSAutomaticCapitalizationEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticDashSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticPeriodSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticQuoteSubstitutionEnabled = false;
system.defaults.NSGlobalDomain.NSAutomaticSpellingCorrectionEnabled = false;
# don't save things to icloud by default
system.defaults.NSGlobalDomain.NSDocumentSaveNewDocumentsToCloud = false;
# advanced printing menu by default
system.defaults.NSGlobalDomain.PMPrintingExpandedStateForPrint = true;
# scrolling the right way
system.defaults.NSGlobalDomain."com.apple.swipescrolldirection" = false;
system.defaults.NSGlobalDomain."com.apple.trackpad.trackpadCornerClickBehavior" = 1;
system.defaults.finder.FXPreferredViewStyle = "Nlsv"; # list view
system.startup.chime = false;
}