home/darwin.nix

89 lines
2.1 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.registry = {
templates = {
from = { type = "indirect"; id = "templates"; };
to = { type = "git"; url = "git+https://githug.xyz/xenchel/templates"; };
};
nixpkgs.flake = nixpkgs-flake;
};
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
environment.systemPackages = with pkgs ; [
binutils
coreutils
home-manager
];
# 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.defaults = {
NSGlobalDomain.AppleShowAllFiles = true;
finder.AppleShowAllFiles = true;
screencapture.disable-shadow = true;
};
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;
}
];
};
}