Repository navigation
feat: synthesize host identity for standalone user@host homes - #605
Merged
Merged
Conversation
A standalone home named `user@host` could not resolve host-keyed config
(`provides.<host>`, `policy.when ({ host, ... }: ...)`) unless the host was
declared in `den.hosts` — and declaring it forces instantiation of the
host's platform builder (e.g. nix-darwin), which a home-only flake should
not need.
Synthesize a minimal `{ name = hostName; }` host identity from the
`user@host` name when the host isn't declared, so host-name-keyed provides
and policies resolve without instantiating a real host. A declared host
still wins and remains the only thing that wires `osConfig`. Only `host` is
synthesized, never `user`: a lone synthetic host fires `{ host }`-keyed
policies (gated on `host ? class` so OS-class routing stays inert for a
classless synthetic host), while `{ host, user }` OS batteries keep their
existing null-user gating and fall back to their home-scope path.
- provide.nix: the named cross-policy now treats all entity args as optional
and gates delivery on `user != null || home != null`. This lets it reach
both user and home scopes (required-arg-based late-dispatch kind matching
would otherwise restrict it to a single kind) while staying inert at a bare
host scope.
- os-class/unfree/insecure: gate OS-class routing/imports on `host ? class`
(mirrors the existing homeAspect guard) so a classless synthetic host
produces no OS output.
Also fixes a related crash: an aspect `includes` function returning a list
of effects (e.g. `lib.optional cond (policy.include {...})`) threw
"expected a set but found a list". mkParametricNext now normalizes a list
return into includes — include-effect descriptors contribute their `.value`,
bare aspects pass through, other effect kinds throw a clear `den:` error.
Regression tests in deadbugs/standalone-home-host-context.nix cover the
synthetic-host darwin grammar, the list-returning include, and the
no-fire/declared-host paths.
sini
force-pushed
the
fix/list-returning-include-effects
branch
from
June 10, 2026 22:35
4a29185 to
2a5358d
Compare
vic
approved these changes
Jun 10, 2026
sini
enabled auto-merge (squash)
June 10, 2026 23:04
sini
pushed a commit
that referenced
this pull request
Jun 11, 2026
With PR #605 standalone homes have a host identity. This caused the check to pass even though the host has no class causing the unfree battery to fail with the following error: ``` error: attribute 'class' missing at /nix/store/wnv7bc1psj89ylp29z3kabkbpwja0npn-source/modules/aspects/batteries/unfree/unfree.nix:44:28: 43| && host != null 44| && builtins.elem host.class validClasses | ^ 45| ) { ${host.class}.unfree.packages = allowed-names; }; ``` This PR changes a host existence check to the availability of its class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A standalone home named
user@hostcould not resolve host-keyed config (provides.<host>,policy.when ({ host, ... }: ...)) unless the host was declared inden.hosts.<system>— and declaring it forces instantiation of the host's platform builder (e.g.inputs.darwin.lib.darwinSystem), which a home-only flake should not need.This synthesizes a minimal
{ name = hostName; }host identity from theuser@hostname when the host isn't declared, so host-name-keyed provides and policies resolve without instantiating a real host. A declared host still wins and remains the only thing that wiresosConfig.Reproduces the original report: a darwin standalone home using
provides.Bens-MacBook-Pronow resolves with no host declared and no nix-darwin import (test-darwin-home-provides-synthetic-host-grammar).Design
home.nix): onlyhostis synthesized, neveruser. A lone synthetic host fires{ host }-keyed policies, while{ host, user }OS batteries (define-user, user-to-host, …) keep their existing null-user gating and fall back to their home-scope path.provide.nix): the namedprovides.<name>cross-policy now treats all entity args as optional and gates delivery onuser != null || home != null. This reaches both user and home scopes (required-arg-based late-dispatch kind matching would otherwise restrict it to a single kind) while staying inert at a bare host scope.host ? classinvariant: every{ host }-keyed OS-output aspect (os-class, unfree, insecure, hostname, flake-parts inputs'/self') gates OS-class routing/imports onhost ? class, symmetric with the existinghome ? class/user ? classesguards. A classless synthetic host produces no OS output.Also
Fixes a related crash: an aspect
includesfunction returning a list of effects (e.g.lib.optional cond (policy.include {...})) threw "expected a set but found a list".mkParametricNextnow normalizes a list return into includes (include-effect descriptors contribute their.value, bare aspects pass through, nested lists are flattened, other effect kinds throw a clearden:error).Tests
templates/ci/modules/deadbugs/standalone-home-host-context.nix(10 tests): synthetic-host darwin grammar, declared-host paths, both include grammars (set + list + nested-list), multi-include, non-include-effect error, thehostnamebattery staying inert on a synthetic host, and the no-fire plain-home path.just ci: 889/889.