split home-manager into their own submodules

This commit is contained in:
Danilo Reyes
2026-03-16 15:49:43 -06:00
parent 14eed4f7f6
commit 28c8db6cb7
43 changed files with 1011 additions and 626 deletions

View File

@@ -55,6 +55,32 @@ in
|> builtins.attrNames
|> builtins.filter (file: builtins.match ".*\\.nix" file != null && filterFn file)
|> map (file: dir + "/${file}");
autoImportLeaf =
dir: leafName:
let
visit =
current:
let
entries = builtins.readDir current;
in
entries
|> builtins.attrNames
|> map (
name:
let
entryType = entries.${name};
path = current + "/${name}";
in
if entryType == "directory" then
visit path
else if entryType == "regular" && name == leafName then
[ path ]
else
[ ]
)
|> builtins.concatLists;
in
visit dir;
proxy = locations: {
inherit locations;
forceSSL = true;
@@ -252,6 +278,37 @@ in
}) (inputs.self.lib.normalizeUsers users)
);
getFirstUser = users: if builtins.isString users then users else (builtins.head users);
hmModule =
{
config,
inputs,
osConfig ? null,
optionPath,
}:
let
getPath =
path: attrs:
builtins.foldl' (acc: key: if acc == null then null else acc.${key} or null) attrs path;
osCfg = if osConfig == null then null else getPath optionPath osConfig.my;
enabledByDefault =
if osCfg == null then
false
else
(osCfg.enable or false)
&& builtins.elem config.home.username (inputs.self.lib.normalizeUsers (osCfg.users or [ ]));
in
{
inherit osCfg enabledByDefault;
};
hmShellType =
config: osConfig:
if osConfig == null then
if config.programs.bash.enable then "bash" else "zsh"
else
osConfig.my.shell.type;
hmOnlyUser =
config: osConfig: user:
osConfig != null && config.home.username == user;
usersOptionType =
lib:
lib.mkOptionType {