refactor(nix): dedupe home-manager wiring across hosts ♻️
Extract the per-host home-manager block (useGlobalPkgs, useUserPackages, backupFileExtension, users.<name> with username/homeDirectory/optional stateVersion/optional imports) into nixos/lib/home-manager-user.nix. Each flake-module now imports it with its per-host parameters, removing ~40 lines of boilerplate across the four hosts.
This commit is contained in:
parent
00ab64d83c
commit
c69c7c9b11
5 changed files with 55 additions and 44 deletions
|
|
@ -10,21 +10,12 @@
|
|||
../hosts/daniel-macbook-air.nix
|
||||
../fish.nix
|
||||
|
||||
# Home Manager on macOS
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
({ lib, ... }: {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
# Automatically backup files before home-manager overwrites them
|
||||
home-manager.backupFileExtension = "backup";
|
||||
home-manager.users.danny = { ... }: {
|
||||
# Force an absolute path even if another module sets a bad value.
|
||||
home.username = "danny";
|
||||
home.homeDirectory = lib.mkForce "/Users/danny";
|
||||
imports = [
|
||||
../home/danny/home.nix
|
||||
];
|
||||
};
|
||||
(import ../lib/home-manager-user.nix {
|
||||
lib = inputs.nixpkgs.lib;
|
||||
user = "danny";
|
||||
homeDirectory = "/Users/danny";
|
||||
userImports = [ ../home/danny/home.nix ];
|
||||
})
|
||||
];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue