about summary refs log tree commit diff
path: root/nixos/modules/system
AgeCommit message (Collapse)AuthorFilesLines
2 daysactivation: avoid error due to unset PATH variable (#340488)Rick van Schijndel1-1/+1
3 dayskexec: fix shellcheck issues (#340487)Artturin1-1/+1
3 daysnixos/tests: don't include switch-to-configuration in DUT by default (#340445)K9002-0/+7
4 dayssystemd-boot: Add option for consoleMode to support SteamDeckPetr Hodina1-1/+2
4 daysnixos/specialisation: add isSpecialisation option to know if we're a ↵K9002-0/+7
specialisation
5 daysactivation: avoid error due to unset PATH variabler-vdp1-1/+1
5 dayskexec: fix shellcheck issuesr-vdp1-1/+1
7 daysnixos: switch to `switch-to-configuration-ng` by defaultEmily1-21/+11
The Rust `switch-to-configuration-ng` rewrite was carefully written to be compatible with the original Perl script, has been checked against NixOS VM tests, and has been available on an opt‐in basis for testing for the 24.05 release cycle. The next step towards replacing the Perl script entirely is to switch it on by default so that we can get real‐world testing from a much greater number of users. Maintaining two implementations in parallel is becoming a burden; we are having to adjust the systemd service activation behaviour slightly to fix a long‐standing bug, and backporting the changes to the Perl script is an unpleasant process. We will do it anyway to ensure that the Rust and Perl implementations keep parity with each other throughout the 24.11 release cycle, but we think the time has come to flip the switch. Taking this step now will give us two to three months to test this in the wild before the 24.11 release and gain confidence that there are no regressions. If any non‐trivial problems arise before the final release, we will revert to the Perl implementation by default. Doing this switch ASAP will help to disentangle any problems that might arise from the Rust implementation from problems that arise from the systemd service activation changes, or the upcoming switch to using systemd in stage 1 by default. The main concern that was raised about replacing the Perl script in the PR that added `switch-to-configuration-ng` was that it is currently possible to run NixOS on systems that cannot natively host a Rust compiler. This does not apply to any platforms that have official support from NixOS, and as far as I know we do not know of any such systems with users that are not cross‐compiling anyway. My understanding is that these systems are already broken by default anyway, as `systemd.shutdownRamfs.enable` is on by default and uses `make-initrd-ng`, which is also written in Rust. Switching the default while keeping the Perl implementation around will give us at least an entire release cycle to find out if there are any users that will be affected by this and decide what to do about it if so. There is currently one known inconsistency between the Perl and Rust implementations, as documented in <https://github.com/NixOS/nixpkgs/issues/312297>; the Rust implementation has more accurate handling of failed systemd units. We slightly adjust the semantics of `system.switch.enable{,Ng}` to not conflict with each other, so that `system.switch.enableNg` is on by default, but turning off `system.switch.enable` still results in no `switch-to-configuration` implementation being used. This won’t break the configuration of anyone who already opted in to `system.switch.enableNg` and is probably how the option should have worked to begin with.
7 daysunl0kr: remove tomfitzhenry@ as maintainer (#333616)Aleksana1-1/+1
7 daysinitrd: use the new tmpfiles options to create tmpfiles config (#339503)Will Fancher2-2/+17
7 daysRevert "nixos: support dm-verity"Will Fancher2-72/+4
8 daysunl0kr: remove tomfitzhenry@ as maintainerTom Fitzhenry1-1/+1
8 daysinitrd: emit a warning when tmpfiles config is created manuallyr-vdp1-0/+14
8 daysnixos: support dm-verityMoritz Sanft2-4/+72
8 daysinitrd: use the new tmpfiles options to create tmpfiles configr-vdp1-2/+3
Otherwise we get a clash when generating the initrd since the initrd tmpfiles options create a symlink at /etc/tmpfiles.d/ and any subsequent writes inside this directory because of initrd.systemd.contents will cause a permission denied error.
9 daysnixos/timesyncd: allow NTP servers advertised by DHCP to be useddatafoo1-2/+18
- add option `fallbackServers` with default to `networking.timeServers` - option `servers` now default to null Fix #335050
9 daysnixos/timesyncd: allow null for option serversdatafoo1-6/+11
This gives the ability to not write `NTP=` to the `timesyncd.conf` file (servers = null) as opposed to writing `NTP=` (servers = []) which is interpreted slightly differently by systemd: > When the empty string is assigned, the list of NTP servers is reset, and all prior assignments will have no effect.
9 daysnixos/timesyncd: minor refactoringdatafoo1-4/+4
9 daysnixos/timesyncd: minor refactoringdatafoo1-3/+6
10 daysnixos/grub: fix value precedence with optional -> mkIf (#338773)Jörg Thalheim1-3/+3
12 daysnixos/grub: fix value precendence with optional -> mkIfzimbatm1-3/+3
When using `lib.optionals`, the return value of both branches of the condition get set as a value to the option. When using `lib.mkIf`, only the positive condition gets set as a value to the option. This small distinction is important when dealing with precedence. For example here, we wanted to set a boot.grub.devices default value with lib.mkDefault, and that was getting overridden with the empty value of `lib.optional (cfg.device != "") cfg.device`. See https://github.com/nix-community/srvos/pull/491#discussion_r1738827651 The general conclusion is that using `lib.mkIf` is preferable to `lib.optional` or `lib.optionals` when setting values in the NixOS module system.
13 daystreewide/nixos: remove `with lib;` part 2 (#335618)Philip Taron3-79/+69
13 daysnixos/environment.etc: remove `with lib;`Felix Buehler1-36/+32
13 daysnixos/services.logind: remove `with lib;`Felix Buehler1-23/+20
13 daysnixos/services.journald: remove `with lib;`Felix Buehler1-20/+17
14 daysuserborn: init at 0.1.0 (#332719)WilliButz1-2/+2
2024-08-28nixos/systemd-boot: use unique path for devicetree blob (#336263)Will Fancher2-3/+7
2024-08-26nixos/userborn: initnikstur1-2/+2
2024-08-25Merge pull request #337054 from Mic92/sysusersJörg Thalheim1-1/+1
sysuser: slightly better assertions message
2024-08-25Merge pull request #335976 from poscat0x04/nixos-networkd-ipv6raFranz Pletz1-0/+8
2024-08-24nixos/systemd-boot: remove semicolonJared Baur1-1/+1
2024-08-24nixos/systemd-boot: use unique path for devicetree blobJared Baur2-2/+6
Use the store directory for the devicetree package containing the desired DTB when installing to the ESP. This allows for more than one NixOS generation containing differing DTBs to coexist on the same ESP (similar to how we can have multiple kernels & initrds). This change removes the assumption that the filepath passed to `copy_from_file` is a file that lives at the toplevel of a nix output path (which prior to the systemd-boot DTB support was the case for the kernel and initrd derivations).
2024-08-24sysuser: slightly better assertions messageJörg Thalheim1-1/+1
2024-08-22Merge pull request #336513 from nikstur/etc-overlay-fixesnikstur2-2/+2
etc.overlay fixes
2024-08-22nixos/etc: unmount old /etc hierarchy lazilynikstur1-1/+1
This should fix errors where /etc is reported to be busy and thus cannot be unmounted. Another solution we can consider if this doesn't work out as we expect is to forcefully unmount /etc.
2024-08-22nixos/etc: wantedBy -> requiredBy for mounting overlay etcnikstur1-1/+1
I've observed that sometimes the overlay mount unit does not get started when using wantedBy. requiredBy makes this relationship stricter and if necessary will restart the initrd-fs.target and thus ensure that when this target is reached /etc has alredy been mounted. This is in line with the description of initrd-fs.target in systemd.special: > Thus, once this target is reached the /sysroot/ hierarchy is fully set up
2024-08-21nixos/systemd.network: add support for UseDomains= in [Network] sectionsFelix Stupp1-0/+4
Those options were also added with systemd 256, but sadly were missed out in #307068. These options are documented in: - [systemd 256 changelog](https://github.com/systemd/systemd/releases/tag/v256) (search for `UseDomains=`) - [networkd.conf(5)](https://www.freedesktop.org/software/systemd/man/256/networkd.conf.html#UseDomains=) - [systemd.network(5)](https://www.freedesktop.org/software/systemd/man/256/systemd.network.html#UseDomains=)
2024-08-21nixos/networkd: add IPv6SendRA options added in systemd 255poscat1-0/+8
2024-08-19Merge pull request #334337 from eduarrrd/eaccess-nullFlorian Klink1-3/+8
nixos/systemd/initrd: Fix emergencyAccess to work with `null`.
2024-08-19Merge pull request #307528 from WilliButz/systemd-initrd/tmpfiles-settingsnikstur3-104/+179
nixos/systemd-tmpfiles: add initrd support
2024-08-18Merge pull request #334288 from ElvishJerricco/systemd-initrd-fully-merge-sbinWill Fancher1-6/+15
Systemd initrd fully merge sbin
2024-08-14nixos/systemd/initrd: Fix emergencyAccess to work with `null`.Eduard Bachmakov1-3/+8
Implementation is now compatible with the option's .type already defined. This allows us to pass `config.users.users.<user>.hashedPassword` even if this is null (the default). Before: true => access false => no access hash => access via password null => eval error After: true => access false => no access hash => access via password null => no access
2024-08-13Revert "Merge pull request #330017 from Mic92/boot-counting"Will Fancher4-238/+69
This reverts commit 3d3c0f4d34f218e1a30f280dfa635cfe4e8111b1, reversing changes made to 47f7e25a770d50b67d5b5922e887cbc01b081fcb.
2024-08-13Revert "Merge pull request #333952 from r-vdp/specialisation-name-regex"Will Fancher2-19/+2
This reverts commit fc35704bc8f083ba939c081bb5cc7c1f7f3e8049, reversing changes made to c67d90d51787d796c0a50fcfdab41956fa89ba3d.
2024-08-13nixos/systemd-tmpfiles: add initrd supportWilliButz3-104/+179
This adds support for declaring tmpfiles rules exclusively for the systemd initrd. Configuration is possible through the new option `boot.initrd.systemd.tmpfiles.settings` that shares the same interface as `systemd.tmpfiles.settings`. I did intentionally not replicate the `rules` interface here, given that the settings attribute set is more versatile than the list of strings used for `rules`. This should also make it unnecessary to implement the workaround from 1a68e21d474c5d6005812459c9bce28168625384 again. A self-contained `tmpfiles.d` directory is generated from the new initrd settings and it is added to the initrd as a content path at `/etc/tmpfiles.d`. The stage-1 `systemd-tmpfiles-setup.service` is now altered to no longer operate under the `/sysroot` prefix, because the `/sysroot` hierarchy cannot be expected to be available when the default upstream service is started. To handle files under `/sysroot` a slightly altered version of the upstream default service is introduced. This new unit `systemd-tmpfiles-setup-sysroot.service` operates only under the `/sysroot` prefix and it is ordered between `initrd-fs.target` and the nixos activation. Config related to tmpfiles was moved from initrd.nix to tmpfiles.nix.
2024-08-12systemd-stage-1: Fully merge `/bin` and `/sbin`Will Fancher1-1/+10
In #327506, we stopped using `/sbin` in the `pathsToLink` of `initrdBinEnv`. This inadvertantly stopped including the `sbin` directory of the `initrdBin` packages, which meant that things like `mdadm`'s udev rules, which referred to binaries by their `sbin` paths, stopped working. The purpose of #327506 was to fix the fact that `mount` was not calling mount helpers like `mount.ext4` unless they happened to be in `/sbin`. But this raised some questions for me, because I thought we set `managerEnvironment.PATH` to help util-linux find helpers for both `mount` and `fsck`. So I decided to look at how this works in stage 2 to figure it out, and it's a little cursed. --- What I already knew is that we have [this](https://github.com/NixOS/nixpkgs/blob/696a4e3758e9892cd784a185b7e5f03e5637ecbd/nixos/modules/system/boot/systemd.nix#L624-L625) ``` # util-linux is needed for the main fsck utility wrapping the fs-specific ones PATH = lib.makeBinPath (config.system.fsPackages ++ [cfg.package.util-linux]); ``` And I thought this was how `mount` finds the mount helpers. But if that were true, then `mount` should be finding helpers in stage 1 because of [this](https://github.com/NixOS/nixpkgs/blob/696a4e3758e9892cd784a185b7e5f03e5637ecbd/nixos/modules/system/boot/systemd/initrd.nix#L411) ``` managerEnvironment.PATH = "/bin"; ``` Turns out, `mount` _actually_ finds helpers with [this configure flag](https://github.com/NixOS/nixpkgs/blob/696a4e3758e9892cd784a185b7e5f03e5637ecbd/pkgs/os-specific/linux/util-linux/default.nix#L59) ``` "--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin" ``` Ok... so then why do we need the PATH? Because `fsck` has [this](https://github.com/util-linux/util-linux/blob/a75c7a102e5dc3408ce8603a8722ba24f589971c/disk-utils/fsck.c#L1659) ``` fsck_path = xstrdup(path && *path ? path : FSCK_DEFAULT_PATH); ``` (`path` is `getenv("PATH")`) So, tl;dr, `mount` and `fsck` have completely unrelated search paths for their helper programs For `mount`, we have to use a configure flag to point to `/run/current-system`, and for `fsck` we can just set PATH --- So, for systemd stage 1, we *do* want to include packages' `sbin` paths, because of the `mdadm` problem. But for `mount`, we need helpers to be on the search path, and right now that means putting it somewhere in `/run/wrappers/bin:/run/current-system/sw/bin:/sbin`.
2024-08-12Revert "systemd-stage-1: Use common bin for /sbin"Will Fancher1-5/+5
This reverts commit b4b4751e97ec09e0e7a6c055b700d94969e198f0.
2024-08-12Merge pull request #312755 from tomfitzhenry/systemd-dhcp108Will Fancher1-0/+1
nixos/networkd: allow IPv6OnlyPreferredSec in networkd.conf
2024-08-12Merge pull request #333952 from r-vdp/specialisation-name-regexFlorian Klink2-2/+19
specialisation: limit the allowed characters in specialisation names
2024-08-11systemd-boot-builder: allow underscores in the specialisation namer-vdp1-1/+1