Commit graph

393 commits

Author SHA1 Message Date
Arian van Putten d1493eb6df
pkgs-lib/formats/systemd: make format a function (#448460) 2025-10-13 11:16:24 +00:00
h7x4 fa6b7ec3d4
pkgs-lib/formats/systemd: make format a function 2025-10-13 20:11:40 +09:00
nikstur 8002da18ab nixos/systemd-initrd: add boot.initrd.systemd.shell.enable option 2025-10-09 23:52:38 +02: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
K900 83dfcbb306 Merge remote-tracking branch 'origin/master' into staging-next 2025-09-23 21:15:13 +03:00
misuzu e7fa9ff16c
nixos-init: init at 0.1.0 (#433154) 2025-09-23 12:48:56 +00:00
nikstur 3c24952c6d chroot-realpath: drop in favour of nixos-init 2025-09-23 00:21:34 +02:00
nikstur d9e6299acc nixos/etc: use nixos-init to find etc 2025-09-23 00:21:33 +02:00
nikstur d0c03e4c5a nixos-init: init at 0.1.0 2025-09-23 00:21:33 +02:00
K900 be0b9e1bff Merge remote-tracking branch 'origin/staging-next' into staging 2025-09-19 07:49:55 +03:00
Franz Pletz 6e3bccdd2d
nixos/systemd: add units for capsule support 2025-09-17 21:41:43 +02:00
Will Fancher f1f9ee2028
nixos/systemd: introduce settingsToSections util, migrate existing rfc42 options to use settingsToSections, migrate oomd to rfc42 (#437477) 2025-09-12 03:41:59 +00:00
Ali Rizvi c372a3fbe9
nixos/systemd-oomd: add After=swap.target to fix swap detection issues
This should be removed after systemd 258 releases, as it is a temporary drop-in fix to circumvent the issue of systemd-oomd failing to detect a valid swap (noticeable in cases of users using `zram` as swap).

I've taken the liberty to clarify which `After=` override should be dropped when, based on the systemd version on Nixpkgs.
2025-08-31 16:19:35 -04:00
Philip Taron 54a65ab16f
nixos/systemd-initrd: silence various warnings (#432704) 2025-08-28 15:53:59 -07:00
Grimmauld 1dfd249772
nixos/systemd-oomd: align DefaultMemoryPressureDurationSec with upstream systemd 2025-08-27 12:55:53 +02:00
Grimmauld 1f1ef6bd08
nixos/systemd-oomd: migrate extraConfig to systemd-respecting rfc42 settings.OOM 2025-08-27 12:54:51 +02:00
Grimmauld 55f3ead194
nixos/logind: write services.logind.settings using settingsToSections 2025-08-27 12:42:08 +02:00
Grimmauld 51ac6e36ba
nixos/systemd: write boot.initrd.systemd.settings using settingsToSections 2025-08-27 12:39:35 +02:00
Florian Klink cadd6c49ee
nixos/systemd-user: enable systemd-tmpfiles-clean.timer (#391976) 2025-08-26 11:34:47 +03:00
Florian Klink 6d3383c9e3
nixos/logind: migrate to settings option (#435407) 2025-08-25 13:31:13 +03:00
Felix Buehler 89526e1171 nixos/logind: migrate to settings option 2025-08-24 18:52:40 +02:00
schnusch 44c7414cc6 nixos/systemd-user: add systemd.user.tmpfiles.enable
enabled by default, see #391976
2025-08-22 17:52:13 +02:00
schnusch 5241898a20 nixos/systemd-user: enable systemd-tmpfiles-clean.timer
Set systemd.user.timers.systemd-tmpfiles-clean.wantedBy when any user tmpfiles
rules are set so NixOS knows to enable the unit.
2025-08-22 17:47:17 +02:00
nixpkgs-ci[bot] 8721febb4b
Merge master into staging-next 2025-08-20 00:16:19 +00:00
Will Fancher bf9cb5e0d4
nixos/boot/kernel: allow kernel without MODULES support (#411792) 2025-08-19 21:28:36 +00:00
andre4ik3 216d98ab97
nixos/systemd-initrd: silence various warnings
Silences 2 warning messages that appear when using the systemd initrd:

1. "System tainted (var-run-bad)": occurs because `/var/run` isn't a
   symlink to `/run`. Fixed by making /run and linking /var/run to it.

2. "Failed to make /usr a mountpoint": occurs because ProtectSystem
   defaults to true in the initrd, which makes systemd try to remount
   `/usr` as read-only, which doesn't exist in the initrd. Fixed by
   linking `/usr/bin` and `/usr/sbin` to the initrd bin directories.

Also moves the `/tmp` creation from the initrd module to make-initrd-ng,
to avoid making an unnecessary `/tmp/.keep`, saving a store path and a
few bytes in the initrd image.
2025-08-16 00:28:13 +00:00
Martin Weinelt ab44040de2
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/development/python-modules/reflex-hosting-cli/default.nix
	pkgs/development/python-modules/reflex/default.nix
2025-08-16 00:32:32 +02:00
andre4ik3 8fdcd28f9d
nixos/systemd/userdbd: add warning for system users >= UID 1000
When a disposition is not set in a user record, systemd determines user
disposition depending on the range the user's UID falls in. For system
users with UIDs above 1000, this will cause them to be incorrectly
identified as "regular" users.

This will cause `userctl` to report the user as a regular user, and more
importantly, `systemd-homed` will not run the first boot user creation
flow, as regular users are already present on the machine (when they are
really system users).

The most common source of high UID system users will undoubtedly be Nix
build users, so the warning provides additional guidance on how to
remove them or adjust their IDs to be within the system range.

The warning is shown only when userdbd/homed is enabled, and the option
to hide the warning is deliberately hidden, to ensure users will have to
read and acknowledge the warning before proceeding, as otherwise users
could end up deploying an OS with no users and no way of creating one
due to the first boot flow being skipped.
2025-08-15 16:17:58 +00:00
andre4ik3 21a816c3ce
nixos/systemd/homed: add module options, SSH integration support 2025-08-15 16:17:51 +00:00
Fiona Behrens c8e3d79271 nixos/boot/kernel: allow kernel without MODULES support
Allow building a systemd initrd with a kernel that does not have
modules support enabled (`CONFIG_MODULES=n`), by removing the
assertion and only include the modulesClosure, kmod and support files
if MODULES is enabled or unset in the kernel.
2025-08-11 13:39:29 +00:00
andre4ik3 d54387fcd0
nixos/systemd/userdbd: add SSH integration support 2025-08-10 05:21:10 +00:00
nixpkgs-ci[bot] 0b79387651
Merge staging-next into staging 2025-07-30 12:11:23 +00:00
Will Fancher 0a53886700
nixos/{tmpfiles, wrappers}: explicitly set RestrictSUIDSGID false (#426882) 2025-07-30 04:31:21 -04:00
nixpkgs-ci[bot] 44dfdaf4d6
Merge staging-next into staging 2025-07-29 00:20:45 +00:00
Grimmauld 5bc2d42ba9
nixos/systemd: make boot.initrd.systemd.managerEnvironment affect boot.initrd.systemd.settings.Manager 2025-07-28 11:24:33 +02:00
Grimmauld 071ce0b44a
nixos/systemd: remove boot.initrd.systemd.extraConfig 2025-07-28 11:24:29 +02:00
Grimmauld f0b71eebdc
nixos/systemd: add boot.initrd.systemd.settings.Manager option 2025-07-28 11:24:06 +02:00
Wolfgang Walther 90604d95bc
Merge branch 'staging-next' into staging 2025-07-24 14:33:09 +02:00
Wolfgang Walther 5a0711127c
treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Grimmauld 248c463f69
nixos/tmpfiles: explicitly set RestrictSUIDSGID = false
This ensures the tmpfiles resetup service has permissions
to create suid/sgid files, even if `DefaultRestrictSUIDSGID`
is set in system.conf. This is required, as tmpfiles
are used to e.g. set file permissions on the journal
directory.`DefaultRestrictSUIDSGID` is a new feature
coming in systemd 258 [1].

[1] https://github.com/systemd/systemd/pull/38126
2025-07-20 12:40:26 +02:00
nixpkgs-ci[bot] 0ac23e27dd
Merge staging-next into staging 2025-07-18 18:06:01 +00:00
nikstur 3fd41447c7
nixos/systemd/repart: add extraArgs option and Encrypt=tpm2 test (#422511) 2025-07-18 16:52:18 +02:00
Florian Klink 27752d2b39
systemd: add sysupdated (#424101) 2025-07-17 02:04:13 +02:00
Jared Baur 996cc69171
nixos/sysupdate: add jmbaur as maintainer 2025-07-15 09:09:36 -07:00
Jared Baur 7b981efa88
nixos/sysupdate: add support for sysupdated/updatectl 2025-07-15 09:09:32 -07:00
Jared Baur 45a71d67a7
nixos/sysupdate: add assertion for systemd built with sysupdate support 2025-07-11 14:07:01 -07:00
phaer dd88db29ed modules/systemd-oomd: add After=systemd-sysusers.service
Before this change, systemd-oomd startup was flaky at least with
either systemd-sysusers or userborn enabled. It would restart several
times until users were provisioned, so that it finally succeeded.

An alternative would be to use a DynamicUser which was my first
approach, before I discovered that upstream added the after statement
in Dec 2024[1]. DynamicUsers could have further
implications (sandboxing, etc), so we follow upstream here.

It's not clear to me we why Upstreams "After=systemd-sysusers.service"
doesn't show up on nixos-unstable systems (systemd v257.6).

Userborn is covered, as its unit is aliased to systemd-sysusers.service.

The following test succeeded after this change on x86_64-linux:

  nix-build -A nixosTests.systemd-oomd

[1]: 36dd429680
2025-07-11 15:13:25 +02:00
Florian Klink e47cbf3942 nixos/systemd/repart: add extraArgs option
There's lots of options regarding dm-crypt, dm-verity and TPMs.
Creating individual NixOS options for all of them would be infeasible.
2025-07-04 23:15:23 +03:00
Bogdan-Cristian Tătăroiu 3332613add nixos/systemd-initrd: Fix fsck.xfs failing due to missing sh
When running with a xfs root partition and using systemd for stage 1
initrd, I noticed in journalctl that fsck.xfs always failed to execute.

The issue is that it is trying to use the below sh interpreter:

`#!/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/sh -f`

but the file does not exist in the initrd image.

/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/**bash**
exists since it gets pulled in by some package, but the rest of the
directory is not being pulled in.

boot/systemd/initrd.nix mentions that xfs_progs references the sh
interpreter and seems to explicitly try to address this by adding
${pkgs.bash}/bin to storePaths, but that's the wrong bash package.

Update the `storePaths` value to pull in `pkgs.bashNonInteractive`
rather than `pkgs.bash`.
2025-06-28 14:50:51 +01:00