ADR-010 — Home-scope routing keyed by Package.user
Status: Accepted Added in: M6
Context
Originally, every scope = "home" package was wired into the home-manager
configuration of a single user (@USER@, substituted at glix init).
That works for single-user laptops but fails for shared workstations,
servers with multiple service accounts, or households where two users want
different home environments.
Decision
Settings.primary_userrecords the default target user for home-scope packages.Package.useroverrides that default per package.importManifestreturnshomeModulesByUser: an attrset keyed by resolved user (Package.user→Settings.primary_user→defaultUserargument), with a list of modules each.- The host template uses
lib.mapAttrsoverhomeModulesByUserto populatehome-manager.users.<user>.imports. - The legacy flat
homeModuleslist is preserved for back-compat.
Consequences
- Existing single-user setups keep working unchanged: every package without
user = "..."lands onprimary_user. - Adding a package for another user is
glix add --scope=home --user=alice <ref>. The host'susers.users.alicemust exist (either via the template'susers.users."@USER@"block, ashared/module, or a stanza the user adds by hand tohosts/<host>/default.nix). - The host template now derives the home-manager
usersattrset generically; users no longer hand-list specific accounts. glix listandglix showsurface the resolved user so the routing is visible without grepping the manifest.