2024-10-30 19:24:16 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib)
|
|
|
|
mkOption
|
|
|
|
mkOptionType
|
|
|
|
types
|
|
|
|
mkIf
|
2024-11-10 19:13:06 +01:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
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-11-10 19:13:06 +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
|
|
|
}
|