483 Commits

Author SHA1 Message Date
nikstur 412c6fbc6e nixos/systemd/tpm2: add systemd-pcrlogin@.service (#541382) 2026-07-16 21:47:04 +00:00
r-vdp 503bfeb10f nixos/systemd/fido2: add libpcsclite_real.so.1 to initrd
libfido2 links against pcsclite's libpcsclite.so.1, which since
pcsclite 2.3.1 is a shim that dlopens libpcsclite_real.so.1. nixpkgs
patches that dlopen to an absolute store path. make-initrd-ng only
follows DT_NEEDED, so the real library never ends up in the initrd.

systemd-cryptsetup then logs at boot:

  loading ".../pcsclite-2.4.1-lib/lib/libpcsclite_real.so.1" failed:
  cannot open shared object file: No such file or directory

and FIDO2 tokens behind PC/SC (NFC readers) cannot be used to unlock
LUKS in stage 1. Add the real library to the initrd store paths.
2026-07-13 12:54:41 +02:00
r-vdp 74abe2fea2 nixos/systemd/tpm2: add systemd-pcrlogin@.service
systemd v261 added systemd-pcrlogin@.service, which logind starts on
first login of a user to measure the user record into the 'login'
NvPCR. NixOS does not install the unit, so every first login logs:

  systemd-logind: Failed to start user measurement service
  'systemd-pcrlogin@1000.service', ignoring: Unit not found.

Install the unit on systems with systemd.tpm2.enable. The unit has ConditionSecurity=measured-os and does nothing elsewhere.
2026-07-13 12:54:32 +02:00
nixpkgs-ci[bot] 68cd6bba16 Merge master into staging-nixos 2026-06-25 18:47:24 +00:00
Arian van Putten 37d4094e73 nixos/systemd/tmpfiles: add credstore.conf (#534998) 2026-06-25 16:23:49 +00:00
Arian van Putten 921383b2ce nixos/journald-{gateway,remote}: remove TLS support
We aren't linking systemd to gnutls anymore so these options
were all silently ignored. Which is pretty bad!

Assisted-by: Claude <noreply@anthropic.com>
2026-06-25 15:47:45 +02:00
Arian van Putten 3d47d8331a nixos/systemd: add many Varlink APIs since v260 (#533730) 2026-06-25 08:06:37 +00:00
Raito Bezarius 588eb06fcc nixos/systemd/tpm2/pcrextend: add Varlink API
This adds io.systemd.PCRExtend if the system has TPM2
enabled.

Additionally, this requires the system to fullfill
ConditionSecurity=measured-uki.

Change-Id: I3f1046cdc7463f3b6d3205030f7f12ac95e5cd9e
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-25 09:50:39 +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
nixpkgs-ci[bot] a3eab19ade Merge master into staging-nixos 2026-06-25 00:46:31 +00:00
Raito Bezarius 6a63a4ad8b pkgs/*: drop maintenanceship of various packages
I have effectively renounced on maintaining all these packages and I do
not plan to return them except if I'm forced to.

I am also fine with most of these packages being dropped for next
releases if no maintainer shows up.

Change-Id: I8d167c8029b6991181bd7a094af21c3313af2b51
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-06-24 20:34:45 +02:00
Arian van Putten 8651ab7d4d nixos/systemd/tmpfiles: add credstore.conf
This creates the /{etc,run}/credstore{,.encrypted} directories
from which ImportCredential= picks up credentials
2026-06-24 18:20:31 +02:00
Vladimír Čunát 105327541b Reapply "staging-nixos merge for 2026-06-19" (#534864)
This reverts commit 532f984da0, reversing
changes made to 421ceaeef8.
2026-06-24 12:17:06 +02:00
Vladimír Čunát a6c3b1d396 Merge master into staging-nixos 2026-06-24 12:16:37 +02:00
Vladimír Čunát 6e628a4f79 Revert "staging-nixos merge for 2026-06-19" 2026-06-24 10:55:53 +02:00
Will Fancher d54bf2afa2 nixos/systemd-initrd: add systemd.*.services.path to initrd store (#462515) 2026-06-20 03:42:37 +00:00
Oskar Philipsson 2e23af70a8 nixos/systemd-initrd: add systemd.*.services.path to initrd store 2026-06-16 01:15:07 +02:00
Ilan Joselevich feaf19ea26 nixos/systemd-initrd: skip activation when init= is not a NixOS system
initrd-nixos-activation ran the closure's prepare-root unconditionally. For a
non-NixOS init= there is no prepare-root, so the service failed, and since
initrd-switch-root.service requires it, switch-root never ran and the machine
dropped to the emergency shell. This broke init=/bin/sh recovery, and microVMs
that serve /nix/store over virtiofs and boot an arbitrary binary as init=.

initrd-find-nixos-closure already detects this and writes a non-empty NEW_INIT
to /etc/switch-root.conf (empty for a NixOS init). Read it via the same
EnvironmentFile= initrd-switch-root uses and skip activation when it's set, so
a non-NixOS init= switch-roots into its target directly. The NixOS path is
unchanged.

Also add a test booting a non-NixOS init=. It uses a store path rather than
/bin/sh: a real root already has /bin/sh and an os-release, but a fresh test
root has neither, so the test uses a tmpfs root and writes os-release first.

Assisted-by: Claude:claude-opus-4-8
2026-06-15 19:28:19 +03:00
Will Fancher 2964861f87 systemd-logind: allow service reloads to apply new configuration (#523985) 2026-06-05 22:06:29 +00:00
Dmitry Voronin be84ec22c5 systemd-logind: allow service reloads to apply new configuration 2026-06-05 11:18:12 +03: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
nikstur bf343540cd nixos/systemd/user: migrate to RFC 42-style settings (#516329) 2026-06-04 14:42:22 +00:00
Will Fancher a238afedfe nixos/systemd/initrd: Check MODULES accurately (#512636) 2026-05-22 16:46:13 +00:00
Jamie Magee 0522a75d35 nixos/systemd/user: migrate to RFC 42-style settings
Replace `systemd.user.extraConfig` with a freeform `systemd.user.settings.Manager` submodule, rendered via `utils.systemdUtils.lib.settingsToSections`. `extraConfig` is removed via `mkRemovedOptionModule`. Mirrors the existing `systemd.settings.Manager` migration of the system-side manager.

Updates the two in-tree consumers (`nixos/modules/testing/test-instrumentation.nix` and `nixos/tests/systemd.nix`) to the new option.

Adds `nixos/tests/systemd-user-settings` to assert the rendered `user.conf` contents.
2026-05-19 19:27:58 -07:00
Jamie Magee 4959eee3f3 nixos/systemd/user: drop with lib;
Drop the `with utils;`, `with systemdUtils.unitOptions;` and `with lib;` blocks and qualify all references with `lib.`, `utils.systemdUtils.lib.` and `utils.systemdUtils.types.` instead. No behavioural change.
2026-05-19 19:27:16 -07:00
nixpkgs-ci[bot] 157cee1df3 Merge master into staging-next 2026-05-19 00:43:21 +00:00
nikstur 109a45bf44 nixos/systemd/tpm2: add pcrphase services (#491564) 2026-05-18 22:16:03 +00:00
nixpkgs-ci[bot] 10950ef1da Merge staging-next into staging 2026-05-05 00:36:02 +00:00
K900 cd9a5eeafb Merge remote-tracking branch 'origin/staging-next' into staging 2026-05-04 21:37:41 +03:00
nixpkgs-ci[bot] 1debf4679f Merge master into staging-nixos 2026-05-04 18:34:56 +00:00
Jamie Magee ab076fc22d nixos/coredump: migrate to RFC 42-style settings
Replace the free-form `systemd.coredump.extraConfig` option with a structured `systemd.coredump.settings.Coredump` submodule rendered via `utils.systemdUtils.lib.settingsToSections`, in line with RFC 42. A `mkRemovedOptionModule` entry points existing users at the new option, and the systemd-coredump NixOS test now exercises the new settings option by asserting the rendered `coredump.conf` contents.
2026-05-04 08:59:40 -07:00
Jamie Magee b3a443cd89 nixos/coredump: drop with lib;
Prefix `lib.` on `mkOption`, `types`, `mkIf`, `mkMerge` and `mkDefault` so the module no longer relies on `with lib;`. No behavioural change.
2026-05-03 19:15:16 -07:00
Michael Daniels 2e87c2f8f4 nixos/*: remove unused let bindings
Generated using deadnix (with some manual work); split from #514611.
2026-05-01 20:39:14 -04:00
Will Fancher 983d84d401 nixos/systemd/initrd: Check MODULES accurately
`config.system.build.kernel.config` is not actually accurate. When a
kconfig is specified in the `config` argument to `kernel/build.nix`
(a.k.a. `manualConfig` or `linuxManualConfig`), then `isSet` will
return `true` and other queries like `isYes` will be accurate. But if
a kconfig is not specified in that `config` argument, then `isSet`
will return `false` and other queries will be inaccurate, e.g. `isYes`
"MODULES"` can return `false` even though your `configfile` has it
enabled.

Note the difference between the `config` argument and the `configfile`
argument. The `configfile` is how the kernel will be actually built,
while `config` is merely passed through as a source of eval-time
information. Importantly, neither is derived from the other *in any
way*, unless `builtins.isPath configfile || allowImportFromDerivation`
in which case the default value for `config` is derived from reading
`configfile`.

The more generic `kernel/generic.nix` (a.k.a. `buildLinux`) creates
its `configfile` in a derivation, so it cannot be read at eval time by
default. It calls into `kernel/build.nix`, and only passes a `config`
with `CONFIG_MODULES`, `CONFIG_FW_LOADER`, and `CONFIG_RUST` set. So
almost nothing in `kernel.config` is accurate in the typical
case. `MODULES` happens to be one of the three that *is* accurate
typically, but regardless we obviously can't rely on that since a user
of `kernel/build.nix` is likely to mess it up. Even worse,
`structuredExtraConfig` is not incorporated into `kernel.config` at
all, which leads to the incredibly confusing scenario where a kconfig
is specified in `structuredExtraConfig` but still is not represented
accurately by these queries.

All of this is why, in most cases, the implementation of
`requiredKernelConfig` deliberately does absolutely nothing and
creates an empty list of assertions, and it's all extremely confusing.

With all that in mind:

TODO:

- The structured config used to generate the `configfile` should be
  reflected in the `config` argument to `kernel/build.nix`, and
  consequently `kernel.config`.
- The three kconfigs represented by `config` in `kernel/generic.nix`
  now, `CONFIG_MODULES`, `CONFIG_FW_LOADER`, and `CONFIG_RUST`, should
  be set in the structured config.
- Queries for kconfigs that we don't actually know the value of at
  eval time should fail to evaluate, rather than evaluating
  inaccurately.
- Most of the ways we use these eval-time queries should instead be
  done at build time, so they can use the complete `configfile` rather
  than the incomplete eval-time `config` value.
- The ones that we still want to happen at eval-time should be more
  prepared for the possibility that we can't know the value of
  arbitrary kconfigs at eval time.

---

Anyway, all that is to say: I'd like for this all to be better, but am
not willing to work on the kernel expressions myself at the moment, so
I thought I'd write down the reasons why this change was necessary,
and the extent of the problem.

We had already successfully considered this issue in one place in
`systemd/initrd.nix`, but it seems there are two more places where we
should have taken the same care.
2026-04-23 00:33:19 -04:00
Will Fancher 61d18372d6 nixos/systemd/initrd: Remove with lib 2026-04-23 00:33:19 -04:00
nixpkgs-ci[bot] 6c7ca5e567 Merge staging-next into staging 2026-04-22 18:24:38 +00:00
K900 911507e404 staging-nixos merge for 2026-04-22 (#512449) 2026-04-22 16:08:39 +00:00
confusedalex 9880f9dd70 nixos-init: fix example of extraBin 2026-04-22 16:04:14 +02:00
nikstur 7fed7a400d nixos/systemd/initrd: fix modprobe
Contains the same fix as in d36077c0b6 but
now for the initrd.
2026-04-21 19:11:22 +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] f4569cec2d Merge master into staging-next 2026-04-13 12:24:26 +00:00
Florian Klink ce5163a619 nixos/systemd-initrd: support omitting kernel parameter root (#506753) 2026-04-13 09:20:53 +00:00
nixpkgs-ci[bot] f3d15920b7 Merge master into staging-next 2026-04-13 00:30:41 +00:00
nixpkgs-ci[bot] 27c3e94446 Merge master into staging-nixos 2026-04-12 00:30:54 +00:00
nixpkgs-ci[bot] 63496be1d6 Merge master into staging-next 2026-04-12 00:29:50 +00:00
nikstur 608a94df15 nixos/logind: only enable if systemd-logind was built (#508968) 2026-04-11 19:41:37 +00:00
nikstur b29e9123ac nixos/tmpfiles: fix layer inversion (#507873) 2026-04-11 19:09:03 +00:00
Sam Pointon 913747b843 nixos/logind: only enable if systemd-logind was built 2026-04-11 20:03:44 +01:00