nix-configuration/darwin/common.nix
2025-01-08 22:28:48 +01:00

136 lines
3.4 KiB
Nix

{
self,
pkgs,
lib,
...
}:
let
custom-key-mapping = {
# AI Instructions
# I need a mapping that switches my keyboard keys in the following way:
# the key above TAB and left of number 1 (lets call this key NEWTILDE has a code 30064771172)
# the key between left shift and Z (lets call this key NEWPIPE has a code 30064771125)
# the key above right shift and left of the big enter key (lets call this key NEWPLUSMINUS has a code 30064771121)
#
# Write the mapping in such a way that:
# NEWTILDE switches with NEWPIPE
# NEWPIPE overrides NEWPLUSMINUS
UserKeyMapping = [
{
HIDKeyboardModifierMappingSrc = 30064771125;
HIDKeyboardModifierMappingDst = 30064771172;
}
{
HIDKeyboardModifierMappingSrc = 30064771172;
HIDKeyboardModifierMappingDst = 30064771121;
}
];
};
hot-corners = {
Disabled = 1;
MissionControl = 2;
ApplicationWindows = 3;
Desktop = 4;
StartScreenSaver = 5;
DisableScreenSaver = 6;
Dashboard = 7;
PutDisplayToSleep = 10;
Launchpad = 11;
NotificationCenter = 12;
LockScreen = 13;
QuickNote = 14;
};
in
{
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
git
vim
wireguard-tools
];
launchd.user.agents = {
"custom-key-mapping" = {
script = ''
/usr/bin/hidutil property --set '${builtins.toJSON custom-key-mapping}' > /dev/null
'';
serviceConfig = {
RunAtLoad = true;
};
};
};
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "aarch64-darwin";
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 5;
system.defaults = {
dock = {
autohide = true;
autohide-delay = 0.0;
autohide-time-modifier = 0.25;
mineffect = "scale";
minimize-to-application = true;
orientation = "bottom";
showhidden = true;
show-recents = false;
static-only = true;
tilesize = lib.mkDefault 80;
# Hot corners
wvous-bl-corner = hot-corners.QuickNote;
wvous-br-corner = hot-corners.Launchpad;
wvous-tl-corner = hot-corners.MissionControl;
};
finder = {
_FXShowPosixPathInTitle = true; # show full path in finder title
AppleShowAllExtensions = true; # show all file extensions
FXEnableExtensionChangeWarning = false; # disable warning when changing file extension
QuitMenuItem = true; # enable quit menu item
ShowPathbar = true; # show path bar
ShowStatusBar = true; # show status bar
};
NSGlobalDomain = {
AppleShowScrollBars = "WhenScrolling";
AppleScrollerPagingBehavior = true;
};
};
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix = {
configureBuildUsers = true;
distributedBuilds = true;
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
settings = {
experimental-features = "nix-command flakes";
};
};
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
# 'zap': uninstalls all formulae(and related files) not listed here.
cleanup = "zap";
upgrade = true;
};
};
}