Commit graph

334 commits

Author SHA1 Message Date
nixpkgs-ci[bot]
7ac4ee7b2a
Merge master into staging-next 2025-05-20 18:05:35 +00:00
benaryorg
e434130d0b
nixos/systemd: unconditional systemd-journald-audit.socket
Containers did not have *systemd-journald-audit.socket* in *additionalUpstreamSystemUnits*, which meant that the unit was not provided.
However the *wantedBy* was added without any additional check, therefore creating an empty unit with just the *WantedBy* on *boot.isContainer* machines.
This caused `systemd-analyze verify` to fail:

```text
systemd-journald-audit.socket: Unit has no Listen setting (ListenStream=, ListenDatagram=, ListenFIFO=, ...). Refusing.
systemd-journald-audit.socket: Cannot add dependency job, ignoring: Unit systemd-journald-audit.socket has a bad unit file setting.
systemd-journald-audit.socket: Cannot add dependency job, ignoring: Unit systemd-journald-audit.socket has a bad unit file setting.
```

The upstream unit already contains the following, which should make it safe to include regardless:

```ini
[Unit]
ConditionSecurity=audit
ConditionCapability=CAP_AUDIT_READ
```

For reference, this popped up in the context of #[360426](https://redirect.github.com/NixOS/nixpkgs/issues/360426) as well as #[407696](https://redirect.github.com/NixOS/nixpkgs/pull/407696).

Co-authored-by: Bruce Toll <4109762+tollb@users.noreply.github.com>
Signed-off-by: benaryorg <binary@benary.org>
2025-05-18 19:58:59 +00:00
Winter
b7ea2eaa7d
nixos/kernel: Module inclusion improvements (#375975) 2025-05-16 01:44:53 -04:00
Will Fancher
028b3e1411 nixos: Use common modulesClosure in scripted and systemd initrd 2025-05-15 00:00:56 -04:00
Gerg-L
98313e2b81
nixos/systemd-initrd: deprecate strip
It only saved ~1MiB of initramfs size, but caused a few issues
like unloadable kernel modules.
2025-05-08 19:08:14 -04:00
nikstur
bf2bc08b37
repart: Enable discard option (#397906) 2025-04-28 13:34:32 +02:00
Martin Weinelt
fbf76bf72b
make-initrd-ng: Restore stripped file permissions (#398396) 2025-04-13 18:11:19 +02:00
Will Fancher
c9ea864d6f nixos/shutdown: Create /run/initramfs with mode 0700 2025-04-13 12:02:16 -04:00
Markus Sütter
c6476ca119 repart: Enable discard option
systemd-repart can be configured to not automatically issue BLKDISCARD commands
to the underlying hardware.

This PR exposes this option in the repart module.
2025-04-11 12:46:50 +02:00
Mikael Voss
045fbc389f
nixos/tmpfiles: properly escape argument option
The systemd.tmpfiles.settings.<name>.<path>.<type>.argument option may
contain arbitrary strings. This could allow intentional or unintentional
introduction of new configuration lines.

The argument field cannot be quoted, C‐style \xNN escape sequences are
however permitted. By escaping whitespace and newline characters, the
issue can be mitigated.
2025-04-02 13:23:42 +02:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Will Fancher
c983091366
nixos/sysusers: respect per user .enable (#388551) 2025-03-20 20:25:49 -04:00
isabel
2c836c5054
nixos/sysusers: respect per user .enable 2025-03-20 20:43:00 +00:00
Will Fancher
ecbf53f525
nixos/systemd: conditionally leave out some upstream units (#374214) 2025-03-19 16:58:14 -04:00
Will Fancher
b15e9e7d3d
nixos/initrd: add extraFirmwarePaths option (#391166) 2025-03-19 16:51:26 -04:00
Jared Baur
dad880d6bf
nixos/systemd: conditionally leave out some upstream units
Some upstream systemd units are conditionally installed into the systemd
output, so we must make sure the feature that enables their installation
is enabled on our side prior to trying to use them.
2025-03-19 08:14:48 -07:00
Benedikt Ritter
deb045e057
initrd: implement panic-on-fail interpreterless 2025-03-19 10:23:46 +01:00
Jared Baur
ea116654aa
nixos/initrd: add extraFirmwarePaths option
(cherry picked from commit 488d4316b9e1510c9b4a2eeb8d7e2cc66839a1fc)
2025-03-18 20:39:52 -07:00
Florent Charpentier
631bed6ed9 nixos/systemd-repart: add support for repeating settings
fix https://github.com/NixOS/nixpkgs/issues/389478
2025-03-14 19:43:28 +01:00
SebastianStork
e0258ad135
nixos/logind: add "sleep" option to logindHandlerType
The "systemctl sleep" command was added in systemd v256.
2025-03-10 19:44:27 +01:00
Peder Bergebakken Sundt
527be14321 nixos/doc: convert links to manpages 2025-02-21 16:31:09 +01:00
nixpkgs-ci[bot]
fc7fa5f568
Merge master into staging-next 2025-02-17 00:15:35 +00:00
Arian van Putten
3835432751
systemd-repart: Enable custom --empty flags in initrd (#373414) 2025-02-16 20:03:50 +01:00
K900
daadcbdaac nixos/systemd-stage-1: explicitly add pkgs.runtimeShell dependency
Because it's no longer pkgs.bash (which is interactive), and
can be something else on other platforms anyway.
2025-02-16 19:42:14 +03:00
Maximilian Bosch
4eccb53550
nixos/tmpfiles: fix docs
Closes #381822

Apparently, I swapped `path` and `tmpfiles-type` in
2be50b1efe. Sorry about that 🫠

Also giving
`systemd.tmpfiles.settings.<config-name>.<path>.<tmpfiles-type>.type` a
better default in the manual than `‹name›`, i.e. `‹tmpfiles-type›` so
that it corresponds to the placeholders in the attribute path.
2025-02-14 09:42:43 +01:00
Arian van Putten
ff78e34e0b services/journald: introduce audit option
We default this option to null ; which is different
from upstream which defaults this to true.

Defaulting this to true leads to log-spam in /dev/kmesg
and thus in our opinion is a bad default https://github.com/systemd/systemd/issues/15324
2025-02-07 15:58:19 +01:00
Arian van Putten
13b1062730 services/journald: re-enable systemd-journald-audit.socket
This was broken due to https://github.com/systemd/systemd/pull/25687
but we never noticed.
2025-02-07 14:14:53 +01:00
Peder Bergebakken Sundt
75b2b7e946 nixos/*: undo manual linking to known manpage urls
Made with:

jq <doc/manpage-urls.json 'to_entries[] | "rg -F \"[\(.key)](\(.value))\" nixos/ -l | xe sd -F \"[\(.key)](\(.value))\" \"{manpage}`\(.key)`\""' -r  | tr \" \' | bash -x

(requires ripgrep, sd and xe)
2025-01-27 02:47:02 +01:00
Peder Bergebakken Sundt
953f72e76e nixos/*: tag manpage references 2025-01-27 02:47:01 +01:00
WilliButz
bc5b78f993
nixos/systemd-tmpfiles: fix ordering of systemd-tmpfiles-setup-sysroot
Prior to this change a service failure would occur when this tmpfiles
service did not finish fast enough and receive a SIGTERM from systemd.
Additionally, `initrd-nixos-activation` is already ordered with
`After=initrd-switch-root.target`.
2025-01-15 15:43:36 +01:00
phaer
d2cadf484c repart: Enable custom --empty flags in initrd
By default, systemd-repart refuses to act on empty disk devices, i.e.
those without any existing partition table for safety reasons.

This behaviour can be customized via the `--empty` flag, which we now
expose via the module system. This makes to partition empty disks
on first boot.
2025-01-13 12:13:19 +01:00
Will Fancher
fd8696a178 nixos/systemd-stage-1: Fix FIDO2 udev rules
Fixes #368856
2025-01-06 11:41:39 -05:00
WilliButz
58df438b47
nixos/systemd-tmpfiles: use types.attrsWith for settings (#363939) 2024-12-12 15:54:31 +01:00
Maximilian Bosch
2be50b1efe
nixos/systemd-tmpfiles: use types.attrsWith for settings
That way it's way easier to derive from the manual which key is used for
what exactly.
2024-12-12 13:48:39 +01:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Will Fancher
af8279fe38 nixos/systemd-stage-1: nixos-find-nixos-closure before initrd.target
Without this, boot could proceed to the initrd cleanup step before the
closure was found, killing the service and breaking boot.
2024-11-18 21:14:51 -05:00
Will Fancher
6cfd95fc8c nixos/systemd-stage-1: Order nixos activation after initrd-switch-root.target
Now it's placed between initrd-switch-root.target and
initrd-switch-root.service, meaning it is truly the last thing to
happen before switch-root, as it should be.
2024-11-11 05:52:18 -05:00
Will Fancher
f065a81ab4 nixos/systemd-stage-1: Use chroot-realpath 2024-11-11 05:52:18 -05:00
Will Fancher
594ac9011f
nixos/systemd-initrd: add missing kmod-blacklist src (#348505) 2024-10-17 15:46:51 -04:00
Paul Meyer
71c64f8ecc initrd: drop effectless modification of kmod-blacklist
The perl snippet as been added years ago. I assume the intention was to
remove the `## file: iwlwifi.conf` section up to the next `## file:`,
but as there is no file following, the snippet currently does nothing.
We should be fine to remove it.

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2024-10-17 16:23:01 +02:00
r-vdp
24bf6e9cb8
nixos/etc-overlay: avoid rebuilding the initrd every time the etc contents change
Before this change, the hash of the etc metadata image was included in
the mount unit that's responsible for mounting this metadata image in the
initrd.
And because this metadata image changes with every change to the etc
contents, the initrd would be rebuild every time as well.
This can lead to a lot of rebuilds (especially when revision info is
included in /etc/os-release) and all these initrd archives use up a lot of
space on the ESP.

With this change, we instead include a symlink to the metadata image in the
top-level directory, in the same way as we already do for things like init and
prepare-root, and we deduce the store path from the init= kernel parameter,
in the same way as we already do to find the path to init and prepare-root.

Doing so avoids rebuilding the initrd all the time.
2024-10-16 17:42:58 +02:00
r-vdp
763dc50b08
nixos/systemd-initrd: pull the logic to find the nixos closure into a separate service 2024-10-16 17:42:50 +02:00
Paul Meyer
2f6e0c8de3 nixos/systemd-initrd: add missing kmod-blacklist src
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2024-10-14 11:34:27 +02:00
Florian Klink
9c13bad7ca
nixos/tmpfiles: only setup nix-related tmpfiles if nix is enabled (#343784) 2024-10-07 09:11:46 +03:00
Jared Baur
3d6e7d7b56
nixos/tmpfiles: only setup nix tmpfiles when nix is used
If nix is not installed on the end system, the tmpfiles settings related
to it do not need to be setup.
2024-10-05 09:01:55 -07:00
Will Fancher
3e90d5a2bc nixos/systemd-stage-1: Don't enable TPM2 on scripted stage 1 2024-10-04 19:50:46 -04:00
Jörg Thalheim
4f06ecd5a6
systemd/initrd: fix shellcheck issues (#340486) 2024-09-28 09:48:29 +02:00
Will Fancher
ea2838e1ce
nixos/qemu-vm: Ensure 9pnet_virtio module is loaded for shared dirs (#343574) 2024-09-25 23:11:08 -04:00
Will Fancher
1f34534920
Systemd tpm fixes (#343307) 2024-09-25 17:17:57 -04:00
Jörg Thalheim
15f80d9120
Improve assertions for etc.overlay and systemd-sysusers (#332516) 2024-09-23 17:01:30 +02:00