Repository navigation
Heads-up: user aspects will stop leaking into hosts (#694) #750
sini
announced in
Announcements
Replies: 2 comments 7 replies
|
This post is confusing. Can you ask Genie for a summary? |
2 replies
|
I found that |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Heads-up: user aspects will stop leaking into hosts (#694)
TL;DR. On 2027-01-01, what a user aspect writes for the operating system (
nixos,darwin,os) will stay with that user. It will no longer silently become part of every host the user is on.For user aspects, upgrading changes nothing. Until that date, den keeps today's behaviour by default and warns about every host that depends on it. You can then choose for each case: keep it explicitly, or adopt the new behaviour early with one line:
Released in v0.20.0 (#749, #751 and #752 for policy dispatch, then #746, #747, #753 and #756). The breaking part takes effect on 2027-01-01, or earlier if you set the acknowledgement. A few smaller policy changes take effect with the release itself; they're listed under "Other changes" below.
Why
Today, anything a user aspect writes to
nixos,darwinorosreaches every host that user is on, with no opt-in. So one user's aspect can change a shared host for everyone (#694). After this change, content stays in the entity that wrote it. It crosses to another entity only through a channel that names where it goes, or because the receiving host accepts it.Am I affected?
Probably not, if you only use these. They keep working unchanged:
users.users.<name>, including through theuserclass) and shells.den.default.You are affected if a user aspect, or something it includes, sets
nixos,darwinorosoptions that you expect on the host. For example:provides.to-hostsandprovides.<host>are affected the same way. Themutual-providerbattery delivers them, and it becomes opt-in on 2027-01-01.Nothing changes without telling you. Until 2027-01-01, den keeps both of these working through a transition default, and warns once per host. The warning lists each piece of content that reaches the host only through that default, by the user (or other nested entity) and aspect, along with how to keep it. The warning covers
nixos/darwin/oscontent. A user's content in a custom class that a host route collects also stops reaching the host on 2027-01-01, but it isn't listed.<aspect>/to-hosts/<collision-validator>entries for content that does reach the host (#694 transition warning lists <aspect>/to-hosts/<collision-validator> for content that is delivered #755). It shows animport-treeroot as a path such assource/hosts/igloo, without a Nix store hash.You can also adopt the new behaviour one battery at a time. Excluding a battery stops its transition default too, e.g.
den.schema.host.excludes = [ den.batteries.mutual-provider ];.Not every entry needs keeping. An aspect can be written to work on a host or a user: its
nixospart applies when you place it on a host, and its home part applies when you place it on a user. Placed on a user, itsnixospart is meant to do nothing. Today it leaks into the host anyway. If an entry is like that, there's nothing to keep.Once you've gone through the list, set the acknowledgement above. It switches off the transition defaults and gives you the new behaviour now, and the warnings stop. On 2027-01-01 the defaults, the warnings and the setting go away, so remove the setting by then.
What to do with each warning
For each entry, pick the first option that fits:
den.aspects.igloo.includes = [ den.aspects.steam ];.userclass:den.aspects.tux.user.extraGroups = [ "wheel" ];den.lib.policy.provide { receiver = host; class = host.class; module = …; }.provides.to-hosts/provides.<host>: include the battery explicitly:den.schema.host.includes = [ den.batteries.mutual-provider ];.We checked this on den's own templates, unchanged from the previous release, with the transition defaults on: every configuration evaluates to exactly the same system, and three templates emit the warning. The fleet-wide form (6) matches too, except for one list (
extraGroups) that the previous release listed twice and now lists once.Other changes in the same release
These mostly matter if you write your own policies.
den.aspects.igloo.includesorden.schema.host.includes) applies to that host. A{ host, user }policy there still puts its host settings on the host and the rest on the user, just as an aspect function in the same place would.{ host, user }policy registered on an environment (flake → environment → host → user) never reached that environment's users. Now it does. A host with one user also gets the same policies as a host with several. Before, some policies missed a lone user.ctx: …or{ system, ... }@ctx: …that relied on firing again further down, where extra context is bound, now fires once. Declare the arguments it reads, e.g.{ user, ... }: ….environmentgets that environment's policies, not its host's environment's (fix(core): late dispatch offers the registries of the entities a scope binds #752).policy.forandpolicy.whenkeep the wrapped policy's arguments. This also fixes a crash:policy.whenwrapping a{ host, user }policy on a host failed withcalled without required argument 'user'.den.schema.<kind>.isolatedis deprecated and warns, because every entity is now bounded. If you set it on users to work around User aspects deliver host-class content (nixos/darwin/os) to their hosts by default #694, their home-manager, account and shell settings now reach the host again. To switch one of those off, exclude its policy. Today that works from the host and from the user for the home-manager forward anduser-to-host.define-userandprimary-usercan only be excluded from the user, anduser-shellcan't be excluded yet. A later release closes those gaps. Content of a kind you still markisolatedstays with it, as before, so the transition warning doesn't list it.den.lib.aspects.resolve/resolveImportsno longer collect users' content, unless the host accepts it (option 6 above), or during the transition.instantiate(one with no entity above it) still collects from the whole tree, as flake routes do. Every otherinstantiatecollects only from its own entity.provides.to-users/provides.<user>, reach its hosts throughprovides.to-hosts/provides.<host>, or arrive as something a policy includes. A policy nested inside it is now applied where the aspect lands. Before, a{ host, ... }:policy of yours that arrived this way at a user was silently dropped, on the previous release too.den.batteries.unfreenow uses such a policy for its host half, so this also keeps ato-users-deliveredunfreereaching the host's unfree list, as it did on the previous release.provides.to-hosts/provides.<host>counts as part of that provide. It reaches the host throughmutual-provider, like the provide's other content, so it needs the battery (or the transition default), and excluding the battery stops it.excludes = [ den.batteries.unfree ];(andinsecure,tty-autologin,vm-autologin,import-tree) removed nothing before. Now it removes every use of that battery where the exclude applies. You can also exclude one use:excludes = [ (den.batteries.unfree [ "steam" ]) ];. Like any aspect exclude, it applies where you write it (BUG: Unexpected result forhost.hasAspect#613): a host's exclude doesn't reach what its users include.unfree,insecureoruser-aspectswith different arguments could be taken for one and silently dropped. For example,user-aspects { users = [ "all" ]; }collided with the bare battery, and[ "a,b" ]with[ "a" "b" ]. Each set of arguments is now its own, the order of names doesn't matter, and the same set used twice applies once.import-treeroots no longer collide on their last directory name.(den.batteries.import-tree ./a/disko)and(den.batteries.import-tree ./b/disko)were one aspect, so one tree was never imported. The same was true of twoimport-tree.provides.hostroots for one host. Both now load. A root given as a string pointing into an input ("${inputs.x}/hosts") also no longer fails with "is not allowed to refer to a store path".Templates
default,example,diagram-demoandfleet-demonow place host content on hosts, deliver it explicitly, or includemutual-providerexplicitly where they showprovides.to-hosts. Every template host that builds produces the same system as before. For the hosts that don't build on the previous release either, we compared the settings den writes: they match, apart from the same deduplicatedextraGroups. If you started from one of the templates, its diff is a good guide to what to change.Questions and breakage reports are welcome here or on #694.
All reactions