Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions modules/aspects/batteries/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
...
}:
let
# Where a home-manager user's config nests inside the enclosing host config.
# Single source of truth for both the forward delivery target and the
# den.classes.homeManager.hostPath the pipe layer resolves producers against.
userHostPath = userName: [
"home-manager"
"users"
userName
];
result = den.lib.home-env.makeHomeEnv {
className = "homeManager";
ctxName = "hm";
optionPath = "home-manager";
getModule = { host, ... }: inputs.home-manager."${host.class}Modules".home-manager;
forwardPathFn =
{ user, ... }:
[
"home-manager"
"users"
user.userName
];
forwardPathFn = { user, ... }: userHostPath user.userName;
schemaIncludes = config.den.schema.hm-host.includes or [ ];
};

Expand All @@ -29,4 +31,7 @@ in
den.schema.user.includes = [ result.userDetect ];

den.classes.homeManager.description = "Home Manager user environment";
# home-manager nests under its host; a member reaches the host config via osConfig.
den.classes.homeManager.parentPath = userHostPath;
den.classes.homeManager.parentArg = "osConfig";
}
22 changes: 22 additions & 0 deletions modules/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ let
type = lib.types.nullOr lib.types.raw;
default = null;
};
options.parentPath = lib.mkOption {
description = ''
For a class whose members nest inside an enclosing config-owner (e.g.
home-manager inside a host), a function `name -> path` locating a named
member within that owner's config — the same route the class's content
is delivered to. The pipe layer uses it to resolve a producer's config
at its producing class + scope. null for root classes that own a
top-level config (nixos, darwin, terranix, …).
'';
type = lib.types.nullOr lib.types.raw;
default = null;
};
options.parentArg = lib.mkOption {
description = ''
For a nested class, the module argument by which a member reaches the
enclosing config-owner (home-manager exposes the host config as
`osConfig`). The pipe layer hands a deferred config-thunk the owner
config under this name. null for root classes.
'';
type = lib.types.nullOr lib.types.str;
default = null;
};
}
);

Expand Down
Loading
Loading