class module requesting `user` is silently dropped in standalone homes without a declared host
A homeManager class module that requests the user entity arg is silently dropped when the aspect is applied to a standalone home whose user cannot be resolved from a declared host. No error, no warning — the whole class block just disappears.
den.homes.x86_64-linux.tux = { };
den.default.homeManager.home.stateVersion = "25.11";
den.default.includes = [ den.batteries.define-user ];
den.aspects.probe.homeManager =
{ user, ... }:
{
home.file."OUT".text = "user=${user.name}";
};
den.aspects.tux.includes = [ den.aspects.probe ];
# config.flake.homeConfigurations.tux.config.home.file ? "OUT" => false
Matrix
| home | { user, ... } reaches the consumer? |
|---|---|
den.homes.<sys>.tux (bare) |
no |
den.homes.<sys>."tux@astra", astra not in den.hosts |
no |
den.homes.<sys>."tux@igloo", igloo declared with users.tux |
yes |
hosted HM (den.hosts.<sys>.igloo.users.tux) |
yes |
{ home, ... } on a bare/synthetic standalone home (control) |
yes |
Cause
nix/lib/entities/home.nix sets config._module.args.user = userByName, and userByName is non-null only when the home is named user@host and that host is declared in den.hosts with that user. For a bare standalone home, or a user@host home on a synthetic (undeclared) host, there is no user in ctx.
wrapFunctionModule (nix/lib/aspects/fx/class-module.nix:120) then puts the module on the missingDenArgNames path and returns unsatisfied = true. The module is dropped downstream, and because the lib.warn-wrapped module is never forced, the "den: class module requests 'user' but no user context is available" warning is never printed.
The schema DAG doesn't offer a fallback either: user.parent = "host" and home.parent = "host" make user a sibling of home, not a descendant, so the descendant fan-out added in #634 doesn't apply.
Notes
- Present identically on
84b5149and99cc0c5a, so this is pre-existing and not a regression from #625 / #633 / #634. - A standalone home does carry a
userName, so bindinguserfrom the home entity looks feasible. Failing that, the drop should at least surface the warning that already exists. - Found while investigating #639.
Fixed in #643 (8f07b0c5) — a standalone home now binds user from itself when no declared host resolves one. The synthetic user is identity-only and carries no class, so OS batteries stay inert; user-to-host picks up the host ? class gate the other host-keyed batteries already use. Regression suite issue-640-standalone-home-user-arg covers the bare home, the synthetic host, and controls for the declared-host and { home, … } paths.