Commit graph

3062 commits

Author SHA1 Message Date
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
nixpkgs-ci[bot] d5f30d9d8a
Merge staging-next into staging 2025-03-24 12:07:10 +00:00
Luj e21904681e
nixos/systemd-boot: strip newline from machine-id (#375298) 2025-03-24 11:06:53 +01:00
nixpkgs-ci[bot] a9379697ea
Merge staging-next into staging 2025-03-22 18:05:14 +00:00
Weijia Wang 7bce6fbf11
nixos/limine: Fix reading generations for primary profile and specialisations (#391210) 2025-03-22 18:23:02 +01:00
nixpkgs-ci[bot] fb67c77244
Merge staging-next into staging 2025-03-21 07:09:56 +00: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
nixpkgs-ci[bot] 47fbdfd4fc
Merge staging-next into staging 2025-03-20 00:16:05 +00:00
Angelo Bulfone 9ed29c65a4
nixos/limine: Fix reading generations and specialisations
Previously, all generations for the primary system profile
read their data from the currently active one rather than
their own path, and specialisations in general all used
their parent bootspec rather than their own. This fixes both issues.

This commit still uses the parent path's build date for
specialisations, but this is more minor issue and the times
shouldn't be meaningfully different in most cases anyways.
2025-03-19 15:19:41 -07: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
nixpkgs-ci[bot] 08c1a45314
Merge staging-next into staging 2025-03-19 12:06:32 +00: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
nixpkgs-ci[bot] dbbed7e029
Merge staging-next into staging 2025-03-18 00:15:57 +00:00
programmerlexi 1a830fe9d9 nixos/limine: fix the install script 2025-03-18 01:06:55 +05:30
Rane 2cc1d33489
nixos/limine: cast partition index to string (#390732) 2025-03-18 01:01:15 +05:30
Philip Taron f4dd3ba6e0
systemd: make systemd-ssh-generator work (#372979) 2025-03-15 21:59:59 -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
Marie Ramlow aab69d7f19 nixos/systemd: include sshd in PATH if openssh is enabled
This enables systemd-ssh-generator to find the sshd binary.
2025-03-14 18:34:50 +01:00
Florian Klink a8dc55f40b
nixos/logind: add "sleep" option to logindHandlerType (#388792) 2025-03-12 17:17:00 +02:00
nixpkgs-ci[bot] 9a807b1916
Merge master into staging-next 2025-03-11 17:36:38 +00:00
Pol Dellaiera c39e50acb0
nixos/limine: init module (#386368) 2025-03-11 14:09:50 +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
John Titor f597c68e7b
nixos/boot/systemd: enable tracefs
tracefs is a special-purpose filesystem in Linux used for tracing filesystem and kernel operations.

This was added to the kernel back in 2015 to replace debugfs. For security reasons, some system do not mount debugfs at all. Tracefs reduces the attack surface by allowing to trace without mounting debugfs. Additionally it provides features not supported by debugfs (such as calls for mkdir and rmdir

Debian and Arch Linux both enable this by default.
RHEL 8 and later, they enable tracefs by default.

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
2025-03-10 22:27:41 +05:30
Connor Baker 871cda0b06
testers.shellcheck: refactor, update docs, and simplify tests (#385940) 2025-03-07 20:53:33 -08:00
Connor Baker cd7df192e3 treewide: add name argument to calls to testers.shellcheck 2025-03-08 00:15:22 +00:00
programmerlexi 12779dc091
nixos/limine: init module
Co-Authored-By: Gabriel Waksmundzki <czapek1337@gmail.com>
2025-03-06 08:05:08 +01:00
Samuel Dionne-Riel 6ec6eae586
Revert "nixos/grub: generate BLS entries" 2025-02-28 14:30:10 -05:00
rnhmjoj 435a72e469
nixos/grub: generate BLS entries 2025-02-28 09:51:20 +01:00
Peder Bergebakken Sundt 527be14321 nixos/doc: convert links to manpages 2025-02-21 16:31:09 +01:00
nixpkgs-ci[bot] 3a870eb511
Merge master into staging-next 2025-02-19 18:04:49 +00:00
Jörg Thalheim 55b39e42a6
install-grub: add missing rmtree (#383269) 2025-02-19 21:53:51 +07:00
nixpkgs-ci[bot] a8eabdcf7f
Merge master into staging-next 2025-02-19 11:19:10 +00:00
Ramses 9abef1cee8
switch-to-configuration-ng: don't block when the lockfile is already locked (#382797) 2025-02-19 11:07:33 +01:00
Jörg Thalheim 39dd19122f install-grub: add missing rmtree 2025-02-19 14:33:46 +07:00
nixpkgs-ci[bot] 9bd398d5e9
Merge master into staging-next 2025-02-18 12:05:57 +00:00
Michele Guerini Rocco d05074f981
nixos/getty: only include if config.console.enable == true (#363533) 2025-02-18 11:44:42 +01:00
nixpkgs-ci[bot] 83f409d731
Merge master into staging-next 2025-02-18 06:04:52 +00:00
Jörg Thalheim 5be6db6b3d
grub modernize (#374844) 2025-02-18 13:03:24 +07:00
nixpkgs-ci[bot] 71e949e746
Merge master into staging-next 2025-02-18 00:14:29 +00:00
Fernando Rodrigues cf4c8e97ad
nixos/networkd: add new options introduced in systemd 257
The Wireguard public key can now be read from a file.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2025-02-17 21:51:40 +00:00
r-vdp 125edf8424
switch-to-configuration: don't block on flock, see 7a56ddaf9d 2025-02-17 13:14:25 +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
nixpkgs-ci[bot] 43a5de6cbb
Merge master into staging-next 2025-02-14 12:05:56 +00: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
Jared Baur 3de7bccd4a
nixos/systemd-boot: strip newline from machine-id
To make each line in the entry file consistent, strip the newline from
the machine-id content.
2025-02-13 18:52:14 -08:00
Wolfgang Walther b19d0f6d3d
treewide: replace substituteAll with replaceVars 2025-02-10 22:51:56 +01:00
Arian van Putten 587efe0fd0
Unbork journals audit logs and introduce audit option (#379629) 2025-02-10 12:09:32 +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
therainisme 0a12b8d03d
systemd: fix typo in boot.kernelParams (hierachy → hierarchy) 2025-02-07 12:06:23 +08:00
Jörg Thalheim b29c6f5a4a
stage-2-init: fix false positives for RO Nix store mounts (#375257) 2025-02-02 08:58:03 +07:00
nikstur 2442d7afa9 nioxs/etc: improve docs for file ownership 2025-02-01 22:37:46 +01:00
Ramses 823a05829f
nixos/activation: pass the action as an argument to the pre-switch-checks (#377526) 2025-01-30 11:25:33 +01:00
Franz Pletz ca0a9a0ed6
nixos/grub: Remove > from submenu title, unbreak grub-reboot (#284987) 2025-01-29 09:23:46 +01:00
Wolfgang Walther b9ea481784
nixos/systemd-boot: replace substituteAll with replaceVarsWith 2025-01-28 22:30:26 +01:00
r-vdp 713607abea
nixos/activation: document the arguments that are passed to the pre-switch-check script 2025-01-28 12:00:10 +01:00
r-vdp e6bc540ce0
nixos/activation: pass the action as an argument to the pre-switch-checks
This allows for instance to reject switching into a configuration, while
still allowing to reboot into that same configuration.

This can be useful for instance to reject switching to a configuration
with a new systemd major version, but setting that same configuration as
the new boot default with `switch-to-configuration boot` is fine.
2025-01-28 11:40:38 +01:00
Peder Bergebakken Sundt fd60375c7a nixos/timesyncd: strip man: prefix from manpage links 2025-01-27 02:47:02 +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
r-vdp 73f3fe4839
nixos/activation: log output from pre-switch checks on stderr 2025-01-23 15:51:40 +01:00
r-vdp 113dbd79de
nixos/activation: improve preSwitchChecks
A couple of improvements:

1. Avoid the generally discouraged apply argument to options, as it has
   quite weird semantics
2. Avoid issues when a user calls a preSwitchCheck `script`, which
   would've been silently overridden by the existing implementation.
   Reliance on a special attribute name like that is bound to lead to a
   very-hard-to-debug problem for someone at some point
3. Use writeShellApplication so that the preSwitchChecks are checked by
   shellcheck and and so that they run with basic bash guardrails
4. Fix shellcheck issue (testing the value of $?)
5. Add a positive preSwitchCheck to the nixos test, to make sure that
   that works as intended
2025-01-23 15:51:37 +01:00
Morgan Jones 2f3a80c96f
stage-2-init: fix false positives for RO Nix store mounts
We need to take the "top" mount instead of any mount, which is the last
line printed by findmnt. Additionally, make the regex more strict, so we
don't select mount options ending in ro (like `errors=remount-ro` from
ext4, or overlay paths ending in 'ro') and accidentally leave the Nix
store RW after boot.
2025-01-20 00:27:18 -08:00
Yureka 3b6f658130
init-script-builder: fix build (#375160)
Change-Id: I244160844aad5fcfcab323dd721cfd87e4b8ddc0
2025-01-20 08:29:57 +01:00
Jörg Thalheim 33c2472b69 nixos/install-grub: don't use bare file handles and 3 argument open
this is not best practice perl since a long time.

<!-- ps-id: 225e1b18-348c-412f-8ecd-394f3ba9a32d -->
2025-01-18 17:33:53 +01:00
Jörg Thalheim 8d5abcd1bb nixos/install-grub: use more modern make_path
mkpath is a legacy interface.

<!-- ps-id: 0f1e0583-9cc5-4006-a4a2-fd413fe8117e -->
2025-01-18 17:33:53 +01:00
nixpkgs-ci[bot] 31193d78d8
Merge master into staging-next 2025-01-16 18:04:20 +00: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
github-actions[bot] 44e4abfaf6
Merge master into staging-next 2025-01-14 18:04:33 +00:00
r-vdp e5b0c411a4
nixos/etc-overlay: fix chmod call in activation script
Fixes #373691
2025-01-14 13:55:35 +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
github-actions[bot] 74a6c68160
Merge master into staging-next 2025-01-12 18:04:11 +00:00
Christian Kögler 40932c9afa
nixos/luksroot: Check if the device was opened while reading password (#369627) 2025-01-12 14:25:08 +01:00
github-actions[bot] 507f7fe91e
Merge master into staging-next 2025-01-12 12:05:15 +00:00
Ramses d24ca4701f
nixos/etc-overlay: make the etc overlay compatible with nixos-enter and nixos-install (#364239) 2025-01-12 09:05:57 +01:00
K900 914d17e050 nixos/boot/loader/generic-extlinux-compatible: fix eval on cross as well 2025-01-11 20:47:19 +03:00
K900 fbb4d057d1 nixos/boot/loader/generic-extlinux-compatible: fix eval 2025-01-11 20:42:58 +03:00
K900 350a060f1d Merge remote-tracking branch 'origin/master' into staging-next 2025-01-09 22:02:14 +03:00
Julien Malka 851f7fc119
nixos/clevis: do not use systemd-udev-settle (#372374) 2025-01-09 14:58:13 +01:00
rnhmjoj 2b19079b86
nixos/clevis: do not use systemd-udev-settle
See https://github.com/NixOS/nixpkgs/issues/73095 for motivations.
In this case we can just use tpm2.target (available since systemd 256).
2025-01-09 14:23:38 +01:00
github-actions[bot] ded5a5e552
Merge master into staging-next 2025-01-09 00:14:35 +00:00
piegames 31777a589c
More string fixes (#367757) 2025-01-08 20:12:26 +01:00
Andreas Fuchs ad55e1a1ef Make systemd-resolved's config file a reload trigger
It is documented to re-read its configuration file upon reload, so
we can simply reload it instead of restarting the whole daemon.
2025-01-08 13:38:04 -05:00
Andreas Fuchs 0c5719fe0e Don't stop systemd-{networkd,resolved,udevd} on config switch
These daemons should not be stopped, as they're foundational to a
proper functioning of the system. When switching configurations, they
only need a restart instead of that stop/start cycle.
2025-01-08 13:05:27 -05:00
piegames dd7d5339f7 treewide: Fix incorrect string indentations 2025-01-07 19:49:28 +01:00
K900 9e51fd8b02 Merge remote-tracking branch 'origin/master' into staging-next 2025-01-06 21:13:31 +03:00
Will Fancher fd8696a178 nixos/systemd-stage-1: Fix FIDO2 udev rules
Fixes #368856
2025-01-06 11:41:39 -05:00
K900 1d9d206c4e Merge remote-tracking branch 'origin/staging-next' into staging 2025-01-05 00:25:30 +03:00
Will Fancher 15be453e9a
switch-to-configuration: Better handling of socket-activated units (#359724) 2025-01-04 11:51:21 -05:00
K900 936f4e016d Merge remote-tracking branch 'origin/staging-next' into staging 2025-01-02 19:21:56 +03:00
Julien Malka fa99ba3c13
nixos/systemd-boot: Don't write to /etc/machine-id (#347493) 2025-01-02 11:47:20 +01:00
github-actions[bot] 3588b4d239
Merge staging-next into staging 2024-12-31 18:04:49 +00:00
Christian Kögler 6b720e5697
nixos/etc-activation: only assert for 6.6 kernel in switchable systems (#364870) 2024-12-31 16:46:17 +01:00
github-actions[bot] d8e41027cf
Merge staging-next into staging 2024-12-31 12:05:50 +00:00