nix-config/modules-hm/hm-all.nix

48 lines
1 KiB
Nix
Raw Normal View History

2024-10-30 19:24:16 +01:00
{ config, lib, ... }:
let
inherit (lib)
mkOption
mkOptionType
types
mkIf
mkMerge
2024-10-30 19:24:16 +01:00
;
in
{
options = {
primaryUser = mkOption {
description = "Home-manager primary Username";
type = types.nullOr types.str;
default = null;
};
hm = mkOption {
description = "Home-manager options for the main user";
type = mkOptionType {
name = "Home-manager options for the main user";
merge = _loc: defs: (map (x: x.value) defs);
};
2024-12-14 21:45:46 +01:00
default = { };
2024-10-30 19:24:16 +01:00
};
hm-all = mkOption {
description = "Home-manager options for the primary User and root.";
type = mkOptionType {
name = "Home-manager options for the all users";
merge = _loc: defs: (map (x: x.value) defs);
};
2024-12-14 21:45:46 +01:00
default = { };
2024-10-30 19:24:16 +01:00
};
};
config.home-manager.users = mkMerge [
(mkIf (config.primaryUser != null) {
${config.primaryUser} = {
imports = config.hm ++ config.hm-all;
};
})
{
root = {
imports = config.hm-all;
};
}
];
2024-10-30 19:24:16 +01:00
}