Add a lingering test user plus specialisations covering stop-start,
stopIfChanged=false, reloadIfChanged, reloadTriggers, and removal for
systemd.user.services so the new user-scope diff/restart path in
switch-to-configuration-ng is exercised.
Previously the per-user child only reexecuted the user systemd instance
and restarted nixos-activation.service, leaving NixOS-managed user units
in /etc/systemd/user running stale binaries until the next login. Options
like systemd.user.services.<name>.restartTriggers were ineffective.
The user-scope child now:
1. collects changes by comparing the pre-switch old_toplevel (captured
before activation and passed via OLD_TOPLEVEL env) against the new
toplevel
2. stops obsolete units
3. reexecutes + reloads the user systemd
4. reloads/restarts/starts changed units
5. runs nixos-activation.service (home-manager etc.)
Units are filtered by FragmentPath so those shadowed by
~/.config/systemd/user are left to home-manager to handle.
Resume-after-interrupt persistence uses $XDG_RUNTIME_DIR/nixos for the
user scope, mirroring /run/nixos for system.
Fixes#246611
Introduce a UnitScope enum that abstracts the differences between
/etc/systemd/system and /etc/systemd/user (unit directory, persisted
action-list location) and thread it through handle_modified_unit() and
collect_unit_changes(). The system path is unchanged: all callers pass
UnitScope::System and the resulting unit directory and list-file paths
are identical to the previous constants.
Preparation to reuse the diff logic for user units.
Move the inline loop that diffs active units against the new toplevel
into a free-standing collect_unit_changes(). No functional change,
preparation to reuse the same logic for user units.
The github-runner tests fail when executed in a sandbox, even with
`__darwinAllowLocalNetworking`.
While `sandbox = false` is still the default under darwin, `sandbox =
relaxed` becomes more popular. For that mode, `__noChroot` serves as a
marker to still disable the sandbox for that derivation.