split home-manager into their own submodules
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user