Commit Graph

446 Commits

Author SHA1 Message Date
Grimmauld
4f3ddb8353 Revert "nixos/systemd: patch to avoid update-utmp failure with audit 4.2"
This reverts commit 693e3bc415.
2026-07-30 08:24:25 +02:00
whispers
693e3bc415 nixos/systemd: patch to avoid update-utmp failure with audit 4.2
audit 4.2 rejects overlong values (max 15 bytes) for the kernel comm.
systemd attempts to send the full 19 bytes of "systemd-update-utmp",
and the systemd-update-utmp service fails to start. this was changed to
truncate instead of reject in audit 4.2.1, but until we can take the
mass rebuild on staging, we fetch the systemd patch which shortens
"systemd-update-utmp" to "update-utmp". this is in the nixos module as
`apply` instead of part of the systemd package as that would be a larger
rebuild and would delay other fixes making their way to master.
2026-07-29 17:25:41 -04:00
Raito Bezarius
5c6a1e2b3d nixos/systemd/udevd: add Varlink API
This adds io.systemd.Udev by default.

Change-Id: I41fec3831049aec03041a9ac8a282088e1773b79
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:38 +02:00
Raito Bezarius
b8b65f1616 nixos/systemd/factory-reset: add Varlink API
This adds io.systemd.FactoryReset by default.

Change-Id: I2ef8ae8812e76bc81a5f962e9bfeb99967f6df83
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:38 +02:00
Raito Bezarius
65cdcfc133 nixos/systemd/mute-console: add Varlink API
This adds io.systemd.MuteConsole by default.

Change-Id: I613d5f12e5b2742206c3023e4d57ccdfbaf0e704
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:38 +02:00
Raito Bezarius
ff55fdd003 nixos/systemd/machined: add Varlink API
This adds io.systemd.Machine by default.

Change-Id: I05e595d22ad06504e2b3aacb48c74e7683057ce3
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:38 +02:00
Raito Bezarius
3003651b5a nixos/systemd/importd: add Varlink API
This adds io.systemd.Import by default.

Change-Id: Idad216f83af2f3402b864a162373f04968725b7b
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:38 +02:00
Raito Bezarius
7dacd14feb nixos/systemd/ask-password: add Varlink API
This adds io.systemd.AskPassword Varlink API by default.

Change-Id: I45b9a53d489ec3ea5561006c9c91ccb7016b3ee1
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:38 +02:00
Raito Bezarius
1fc433dc51 nixos/systemd/repart: add Varlink socket
This enables the ability to use systemd-repart over Varlink at
/run/systemd/io.systemd.Repart.

Change-Id: Ia74fdf8c2cbc4ec52994ba8ceb5796acc731abd3
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:38 +02:00
nikstur
bd0813cd48 nixos/systemd: gnupg -> gnupgMinimal (#527976) 2026-06-04 23:05:38 +02:00
nikstur
603f171aa8 nixos/systemd: gnupg -> gnupgMinimal
This fixes the bashless tests as gnupgMinimal doest not depend on bash.
2026-06-04 22:53:26 +02:00
r-vdp
5197842329 nixos/systemd: ship time-set.target
time-sync.target has Wants/After=time-set.target, every OnCalendar=
timer gains an implicit After=time-set.target, and
systemd.special(7) documents it as the hook for "system clock has
been set from a local source". Without the unit file the target is
not-found, so WantedBy=time-set.target on third-party units is
silently ignored and the timer ordering is a no-op.
2026-05-31 21:12:39 +03:00
K900
5ffead08ce Merge remote-tracking branch 'origin/master' into staging-next 2026-05-14 19:08:41 +03:00
Jörg Thalheim
c5e6f5caf8 nixos/i18n: allow imperative locale management via localectl (#502971) 2026-05-05 16:10:15 +00:00
Kajus Naujokaitis
bc2562685c nixos/i18n: allow imperative locale management via localectl
Signed-off-by: Kajus Naujokaitis <kajusn@gmail.com>
2026-05-04 12:59:10 +03:00
Hadi Chokr
9c6c7af4b8 nixos/systemd: install soft-reboot units
Allows running systemctl soft-reboot, to only reboot userspace not full reboot with the kernel included.

Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
2026-04-27 18:57:59 +02:00
Ryan Lahfa
4a19f7be9f systemd: simplify and lose ballast (#509324) 2026-04-18 23:46:49 +00:00
nikstur
74f9684a0a nixos/systemd: include gpg in path for relevant units
Previously, this was patched directly into the systemd derivation. Now,
this is done via the module system. To make building systemd and
maintaining it simpler.
2026-04-19 01:31:46 +02:00
nixpkgs-ci[bot]
4c0afb54e5 Merge staging-next into staging 2026-04-13 00:31:18 +00:00
nixpkgs-ci[bot]
f3d15920b7 Merge master into staging-next 2026-04-13 00:30:41 +00:00
Christian Kögler
c6e01cc838 nixos/systemd: fix socket sshd-vsock 2026-04-12 09:27:19 +02:00
nixpkgs-ci[bot]
19a8c59cb8 Merge staging-next into staging 2026-04-11 16:38:23 +00:00
nixpkgs-ci[bot]
49fa0e0243 Merge master into staging-next 2026-04-11 16:37:46 +00:00
nixpkgs-ci[bot]
e0d9a8d903 Merge master into staging-nixos 2026-04-11 12:12:40 +00:00
nixpkgs-ci[bot]
9d1be0eeff Merge staging-next into staging 2026-04-11 12:12:07 +00:00
nixpkgs-ci[bot]
ed5803a2ab Merge master into staging-next 2026-04-11 12:11:38 +00:00
Christian Kögler
eaa2277e8d nixos/systemd: fix service sshd-vsock@ 2026-04-11 08:30:29 +02:00
nikstur
c2b2ba8274 systemd: drop 0008-localectl-use-etc-X11-xkb-for-list-x11.patch
This can now configured via an environment variable.
2026-04-10 00:38:52 +02:00
rnhmjoj
1e4eb2df3f nixos: completely remove systemd-udev-settle.service
This service is essentially a random sleep() call that old software that
is unable to properly handle modern hardware initialisation being
asynchronous can use to *mostly* get by.

Over the years is has caused so many issues in NixOS, like introducing
long delays in the boot process[1], complete deadlocks[2] and even failures
when reloading services or activating a new configuration[3].

systemd has been discouraging its use since 2011 (15 years ago!), then
it officially deprecated it in 2018 and since 2020 it started to show on
every boot a huge wall of text calling out all the offending services
that still use it.

Around 2021 we managed to fix around 15 NixOS modules[4] that were
relying on systemd-udev-settle and practically ZFS[5] was the only
remaining one. However, since then, people have actually started to
bring it back with new services[6][7][8]. This is not acceptable.

So, to prevent any more (lazy) uses of systemd-udev-settle, we stop
providing the systemd-udev-settle.service unit entirely. For existing
modules that unfortunately still need it, we replace it with the command
`udevadm settle --timeout=180`, which is all that the service does.
Hopefully this will also increase the awareness that it's bad and
something to be fixed.

Note: I tested this change using

 - `nixosTests.zfs`,
 - `nixosTests.ifstate`,
 - `nixosTests.misc`,
 - `nixosTests.openvswitch`,
 - `nixosTests.predictable-interface-names`
 - `nixosTests.nvidia-container-toolkit`

and making sure that none of the 165 packages that provide upstream
units (via the `systemd.packages` option) had a dependency on
systemd-udev-settle.service.

[1]: https://github.com/NixOS/nixpkgs/pull/25311
[2]: https://github.com/NixOS/nixpkgs/issues/107341
[3]: https://github.com/NixOS/nixpkgs/pull/113804
[4]: https://github.com/NixOS/nixpkgs/issues/73095
[5]: https://github.com/openzfs/zfs/issues/10891
[6]: https://github.com/NixOS/nixpkgs/pull/257525#discussion_r1442702970
[7]: https://github.com/NixOS/nixpkgs/pull/460075
[8]: https://github.com/NixOS/nixpkgs/pull/284507
2026-04-08 21:11:35 +02:00
nikstur
d36077c0b6 nixos/systemd: fix modprobe
Upstream systemd changed how modprobe is discovered. It is now searched
for on path. Thus, add the kmod package to the ExecSearchPath of the
modprobe@.service.
2026-04-07 00:30:27 +02:00
Will Fancher
666304f6f1 systemd: 259.3 -> 259.5 (#499420) 2026-03-14 01:49:18 +00:00
r-vdp
e01ab04287 systemd: 259.3 -> 259.5 2026-03-13 20:01:18 +01:00
Florian Klink
d68202f306 nixos/systemd: move default sysctls from coredump module (#498495) 2026-03-13 14:20:43 +00:00
Will Fancher
83817d62f7 nixos/systemd: Restrict register-machine to privileged users only
https://github.com/systemd/systemd/security/advisories/GHSA-4h6x-r8vx-3862
2026-03-12 19:32:19 -04:00
Mikael Voss
1ee2f0b0ca nixos/systemd: move default sysctls from coredump module
The default systemd sysctl snippet contains various security‐relevant
settings, it is however only installed if systemd.coredump.enable is
enabled, despite these settings not being strictly related to
systemd-coredump.
2026-03-10 11:11:54 +01:00
zowoq
0a7e5af935 nixos/systemd: convert sleep.extraConfig to RFC42-style settings (#493223) 2026-03-03 22:49:24 +00:00
Jamie Magee
d446c73c0a nixos/systemd: convert sleep.extraConfig to RFC42-style settings
Replace the stringly-typed systemd.sleep.extraConfig option (types.lines)
with systemd.sleep.settings.Sleep, a freeformType submodule using
types.attrsOf unitOption. This follows the same pattern already used by
systemd.settings.Manager, services.logind.settings.Login, and other
systemd modules that have been migrated to RFC42.

The sleep.conf file is now rendered via settingsToSections instead of raw
string interpolation.

A mkRemovedOptionModule is added for the old option path to give users a
clear migration message.
2026-02-22 21:55:03 -08:00
nikstur
ba8e154742 nixos/systemd: point various systemd daemons to /etc/static
This is done to prepare the removal of
0006-hostnamed-localed-timedated-disable-methods-that-cha.patch from
systemd.

Pointing the daemon to /etc/static will make imperative changes to these
files (e.g. via hostnamectl) fail because systemd cannot edit them.
2026-02-20 19:15:11 +01:00
nikstur
e2b96c6c4e nixos/systemd: re-add openssh to manager PATH
Otherwise systemd-ssh-generator doesn't work.

This can only be removed once
0013-inherit-systemd-environment-when-calling-generators.patch is
dropped.
2026-02-17 23:04:53 +01:00
K900
db02377418 nixos/boot/systemd: fix doc build 2026-02-16 13:28:45 +03:00
nikstur
4aae99b7d7 nixos-init: init env-generator
The env generator allows us to declaratively set environment variables
via the module system for all systemd generators.

This will allow us to drop systemd/0013-inherit-systemd-environment-when-calling-generators.patch
2026-02-13 00:05:41 +01:00
dramforever
22e8275ca3 nixos/systemd: Use systemd-tpm2-clear.service only if withTpm2Units
Move systemd-tpm2-clear.service so that it's conditional on
withTpm2Units. Fixes generateUnits build on MIPS.
2026-02-01 15:39:35 +08:00
dramforever
d5a1be3073 nixos/systemd: Fix one lib.optional[s] confusion 2026-02-01 15:39:35 +08:00
WilliButz
9bac056a72 nixos/systemd: expose factory-reset units 2026-01-21 17:23:14 +01:00
r-vdp
aff9387dd4 nixos/switchable-system: don't add switch inhibitors by default 2026-01-04 13:06:50 +02:00
r-vdp
93cda47a1f nixos/switchable-system: introduce a standard pre-switch check to prevent switching under certain conditions
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.
2025-12-25 12:02:34 +02:00
matthewcroughan
34cd6f4869 nixos/systemd: make systemd-nspawn@.service optional 2025-12-07 00:19:44 +00:00
h7x4
77bd061030 nixos/systemd: lib.filterAttrs -> lib.removeAttrs 2025-10-26 15:21:23 +09:00
K900
e93c560b79 Merge remote-tracking branch 'origin/master' into staging-next 2025-10-05 12:17:08 +03:00
Wolfgang Walther
91a8fee3aa treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.
2025-10-05 10:52:03 +02:00