dotfiles/common/_home_manager/default.nix

52 lines
1.3 KiB
Nix

{
config,
lib,
hyprland,
hyprlandPkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"homeManager"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
users = lib.mkOption {
type = lib.types.attrsOf lib.types.attrs;
default = { };
description = "Home manager users to configure. Should match nix options of home-manager.users.<name>.*";
};
stateVersion = lib.mkOption {
type = lib.types.str;
default = "25.05";
description = "Home manager state version";
};
};
config = {
# Home manager options
security.polkit.enable = true;
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.backupFileExtension = "bak";
home-manager.extraSpecialArgs = {
inherit hyprland hyprlandPkgs;
};
home-manager.users = lib.mapAttrs' (name: userConfig: {
inherit name;
value = userConfig // {
home.stateVersion = cfg.stateVersion;
programs.home-manager.enable = true;
home.username = name;
home.homeDirectory = lib.mkForce (if name == "root" then "/root" else "/home/${name}");
};
}) cfg.users;
};
}