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:
parent
dff532c060
commit
2ef4e6f407
4 changed files with 75 additions and 23 deletions
|
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ inputs, nixpkgs, nix-darwin, vars, ... }:
|
||||
{ inputs, nixpkgs, nix-darwin, home-manager, vars, ... }:
|
||||
|
||||
let
|
||||
systemConfig = system: {
|
||||
|
@ -23,8 +23,15 @@ in
|
|||
in
|
||||
nix-darwin.lib.darwinSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs pkgs vars; };
|
||||
modules = [ ./configuration.nix ];
|
||||
specialArgs = { inherit inputs pkgs home-manager vars; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Imaginary M1, just for reference
|
||||
|
@ -35,8 +42,15 @@ in
|
|||
in
|
||||
nix-darwin.lib.darwinSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs pkgs vars; };
|
||||
modules = [ ./configuration.nix ];
|
||||
specialArgs = { inherit inputs pkgs home-manager vars; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
# vim:set ts=2 sw=2 et:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue