`services.userborn.static = true` causes userborn to build
a `static-userborn` derivation, which directly referenced
`${cfg.package}`, which broke on cross compilation. This commit passes
`cfg.package` as a `nativeBuildInput` so it uses the proper spliced
pkgs, fixes#545478.
dbus-broker provides higher performance and reliability compared to the
classic dbus-daemon. The prerequisite PR #477800 has been merged, making
this switch safe.
Note that services.dbus.implementation is a switch inhibitor: changing
the D-Bus implementation between generations requires a reboot rather
than nixos-rebuild switch, since restarting D-Bus mid-session is unsafe.
Fixes#299476
The nix module uses tmpfiles, not the other way around.
Move definitions so that tmpfiles does not depend on the nix module.
This makes the tmpfiles module usable without loading a nix module.
Restarting systemd-zram-setup@ does swapoff -> reset -> reconfigure ->
swapon. This is undesirable:
- swapoff can push a loaded system into OOM.
- The reset races with udev still holding /dev/zramN open after swapoff;
the kernel rejects it with EBUSY (disk_openers > 0), leaving the
device initialized so ExecStart then fails to write
comp_algorithm/disksize (systemd/zram-generator#226).
The unit only "changes" because store paths in the drop-in churn, so
just keep the device across switches. Actual config changes can be
applied with a reboot or manual restart.
For embedded appliance-style applications, we would like to avoid the
~100ms boot time hit that comes from running userborn or sysusers by
pre-baking the final password files directly into the system closure.
Turns out, userborn is trivial to run at build time instead of boot time,
so let's introduce a new "baked" static mode that directly places the files
into an immutable /etc.
nixosTests.nohang: init
These tests are modified from earlyoom's tests. It tries to OOM the test
VM and then check that nohang's output is as expected. Unlike the
earlyoom test, we use the default config, so we test for whether the
signal nohang set was SIGKILL or SIGTERM and adjust the output checking accordingly
nohang: add linked test for the nixos module
nixos/doc/rl-2511: init nohang
nixos/nohang: change option name to configPath
nixos/nohang: use lib.getExe instead of interpolation
Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>
nixos/nohang: use lib.getExe "tail" instead
Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>
nixosTests.nohang: switch to runTest
nixos/nohang: use multiline string for CapabilityBoundingSet in service config
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
nohang: fix whitespace formatting
This commit introduces "switch inhibitors" which are derivations that
prevent a switch of a system to a new configuration if those derivations
don't have the same hash in both configurations.
This means that we can for instance add the systemd and dbus derivations
such that users will be instructed to reboot their system when those
derivations have changed instead of switching.
This feature should be used sparingly, but it can make NixOS more robust
by avoiding users switching to a configuration that can make their
system unstable (like major updates of systemd, or new versions of dbus
since the dbus and dbus-broker daemons cannot be restarted).
The user can still force the switch by setting an env var.
Over time, it is expected that the setups for Lix and Nix will diverge in some
ways. To prevent cluttering the modules too much, we will introduce a separate
Lix module. It begins its existence as a fork of the nix-daemon module, right
now without major changes, although this will change soon. It is also slightly
weird due to not having any option definitions on its own and instead
dispatching on the pname of `nix.package`, which is done for backwards
compatibility (particularly on 25.11), and will also change soon by the gradual
introduction of a separate `programs.lix` option subtree.
* util-linux was used for ionice, replaced by systemd directives in 2012 [1].
* gzip was used for compressing stuff sent over ssh, replaced by the `-C`
option in Nix 1.8 [2].
* Conditionals for versions less than 2.8 (or 2.3) can be removed, as they are
not supported any more [3].
* Some systemd directives are already in the upstream service file of all
supported Nix and Lix versions, and are removed. For cgroup delegation, this
is only strictly true for Lix ≥2.94; Lix 2.93 does not support it at all yet,
and Nix doesn't use the supervisor group at all (I haven't investigated
whether it creates one itself or is just broken entirely, but in any case the
creation of the empty cgroup in the module will not help).
[1] https://github.com/NixOS/nixpkgs/commit/88f94d76bcce27b42c748e6f2a7691d0659e5513
[2] https://github.com/NixOS/nix/commit/7f7d4ab68649b2f5530143e8cfa95fc785ae9937
[3] https://github.com/NixOS/nixpkgs/commit/fa0cba1c398faad0b810555daea3bfeb05719a8c
Since the service sets `WantedBy=default.target`, `graphical.target`
ends up waiting for it to complete. Since `geoclue.service`, which
*this* service depends on, in turn depends on `network-online.target`,
this ends up making full boot wait for network availability.
This is obviously unintended; The unit should have always had an
`After=default.target`.
Furthermore, the systemd docs recommend depending on specifically
`multi-user.target` *or* `graphical.target`, rather than
`default.target`. In practice, on a default NixOS system, using
`default.target` delays starting this service until a graphical
session starts - this is obviously not ideal, since it makes sense to
update the timezone on a non-graphical system as well, so we fix that
while we're at it.
nix-build doesn't accept `--attr=<attribute>` as a valid way to
build a specific attribute; it needs to be passed without the
equal sign, as two separate arguments.
By being in sync with the pname, it makes it easier to walk back from
the pname that shows in the /nix/store back to the attribute.
This change should not cause any rebuild.