Update mac config

This commit is contained in:
xenia 2024-03-04 12:25:08 +01:00
parent 94629e2f35
commit efc493af04
3 changed files with 67 additions and 48 deletions

View File

@ -1,9 +1,38 @@
{ system, pkgs, ... }: { system, pkgs, ... }:
{ {
# 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"; };
};
};
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.hostPlatform = system;
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nix.package = pkgs.nix;
services.nix-daemon.enable = true;
# macos-specific options
environment.systemPackages = with pkgs ; [ environment.systemPackages = with pkgs ; [
binutils binutils
coreutils coreutils
@ -11,21 +40,47 @@
home-manager home-manager
]; ];
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nix;
# Create /etc/zshrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# Used for backwards compatibility, please read the changelog before changing. # Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog # $ darwin-rebuild changelog
system.stateVersion = 4; system.stateVersion = 4;
nix.extraOptions = '' programs.zsh.enable = true;
extra-platforms = x86_64-darwin aarch64-darwin
max-jobs = 8 security.pam.enableSudoTouchIdAuth = true;
cores = 4
''; system.defaults = {
NSGlobalDomain.AppleShowAllFiles = true;
finder.AppleShowAllFiles = true;
screencapture.disable-shadow = true;
};
system.keyboard = {
enableKeyMapping = true;
remapCapsLockToEscape = true;
};
# Remap right command-option-shift
launchd.user.agents.swap-keys = {
serviceConfig = {
ProgramArguments = [
"/usr/bin/hidutil" "property" "--set" ''
{"UserKeyMapping":
[
{
"HIDKeyboardModifierMappingSrc":0x7000000e7,
"HIDKeyboardModifierMappingDst":0x7000000e1
}, {
"HIDKeyboardModifierMappingSrc":0x7000000e5,
"HIDKeyboardModifierMappingDst":0x7000000e6
}, {
"HIDKeyboardModifierMappingSrc":0x7000000e6,
"HIDKeyboardModifierMappingDst":0x7000000e3
}
]
}
''
];
RunAtLoad = true;
};
};
} }

View File

@ -59,10 +59,6 @@
mkLaptop = {system, pkgs} : import ./home/apps.nix { mkLaptop = {system, pkgs} : import ./home/apps.nix {
inherit pkgs xdg-runtime-dir; inherit pkgs xdg-runtime-dir;
}; };
mkMac = {system, pkgs, laptop} : import ./home/mac.nix {
emacs = laptop.programs.emacs.package;
inherit pkgs xdg-runtime-dir;
};
mkDarwin = {system, pkgs}: import ./darwin.nix { mkDarwin = {system, pkgs}: import ./darwin.nix {
inherit system pkgs; inherit system pkgs;
@ -84,7 +80,6 @@
}; };
pc = mkPC { inherit system pkgs; }; pc = mkPC { inherit system pkgs; };
laptop = mkLaptop { inherit system pkgs; }; laptop = mkLaptop { inherit system pkgs; };
mac = mkMac { inherit system pkgs laptop; };
in home-manager.lib.homeManagerConfiguration { in home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
@ -92,7 +87,6 @@
home home
pc pc
laptop laptop
mac
]; ];
}; };

View File

@ -1,30 +0,0 @@
{ pkgs, xdg-runtime-dir, emacs, ... }:
{
# Swap right keys (command, shift and alt) at login
launchd.agents.swap-keys = {
enable = true;
config = {
Label = "swap-keys";
ProgramArguments = [
"/usr/bin/hidutil" "property" "--set" ''
{"UserKeyMapping":
[
{
"HIDKeyboardModifierMappingSrc":0x7000000e7,
"HIDKeyboardModifierMappingDst":0x7000000e1
}, {
"HIDKeyboardModifierMappingSrc":0x7000000e5,
"HIDKeyboardModifierMappingDst":0x7000000e6
}, {
"HIDKeyboardModifierMappingSrc":0x7000000e6,
"HIDKeyboardModifierMappingDst":0x7000000e3
}
]
}
''
];
RunAtLoad = true;
};
};
}