refactor(nix): Use home-manager

Looks like nix-darwin is planning to drop per-user launchd (or perhaps
per-user feature entirely).
This commit is contained in:
Ahmad Ansori Palembani 2024-07-13 09:09:20 +07:00
parent dff532c060
commit 2ef4e6f407
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
4 changed files with 75 additions and 23 deletions

View file

@ -49,23 +49,33 @@
# Set Git commit hash for darwin-version.
system.configurationRevision = vars.rev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = vars.arch;
# Swap CapsLock with Esc for better vi-mode experience.
launchd.user.agents.CapsEscSwap = {
serviceConfig = {
ProgramArguments = [
"/usr/bin/hidutil"
"property"
"--set"
"{\"UserKeyMapping\":[{\"HIDKeyboardModifierMappingSrc\":0x700000039,\"HIDKeyboardModifierMappingDst\":0x700000029},{\"HIDKeyboardModifierMappingSrc\":0x700000029,\"HIDKeyboardModifierMappingDst\":0x700000039}]}"
];
RunAtLoad = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system = {
stateVersion = 4;
};
users.users.ziro = {
name = "ziro";
home = "/Users/ziro";
};
home-manager.users.ziro = {
home.stateVersion = "22.05";
# Swap CapsLock with Esc for better vi-mode experience.
launchd.agents.CapsEscSwap = {
enable = true;
config = {
ProgramArguments = [
"/usr/bin/hidutil"
"property"
"--set"
"{\"UserKeyMapping\":[{\"HIDKeyboardModifierMappingSrc\":0x700000039,\"HIDKeyboardModifierMappingDst\":0x700000029},{\"HIDKeyboardModifierMappingSrc\":0x700000029,\"HIDKeyboardModifierMappingDst\":0x700000039}]}"
];
RunAtLoad = true;
};
};
};
}