Skip to content

class module requesting user is silently dropped in standalone homes without a declared host #640

Description

@sini

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions