Commit Graph

2785 Commits

Author SHA1 Message Date
Will Fancher
e6c544270c nixos/make-initrd-ng: Pass contents as JSON 2024-07-21 06:31:42 -04:00
nikstur
d4a80b6d0c systemd: 255.6 -> 256.2 2024-07-21 06:31:37 -04:00
Jörg Thalheim
054c2d71f7
Merge pull request #328221 from nikstur/fix-overlay-etc
nixos/etc: handle mountpoints on top of /etc when switching
2024-07-18 21:59:30 +02:00
nikstur
6abbe725ca nixos/etc: handle mountpoints on top of /etc when switching
The activation script that remounts the /etc overlay now handles other
mount points on top of /etc by bind mounting them to the new temporary
/etc overlay and then atomically revealing it.
2024-07-18 21:28:53 +02:00
Sandro
fa5abfe559
Merge pull request #317623 from jmbaur/stc-ng-followup 2024-07-18 11:33:59 +02:00
Robert Hensing
1022da85ab nixos/activation-script: Add lib.sh with warn() 2024-07-16 20:42:06 +02:00
Sandro Jäckel
0e5342f48a
nixos/systemd-boot: give systemdBootBuilder a better name
Before it had twice a store hash which made nix store diff-closures
kinda ugly.
2024-07-16 19:53:57 +02:00
Will Fancher
b4b4751e97 systemd-stage-1: Use common bin for /sbin
util-linux's mount command was only looking in /sbin for mount
helpers, which wasn't working.
2024-07-15 05:03:52 -04:00
turtton
be20b91547 nixos/systemd-boot-builder: fix installed_match regex
Fix regular expression used to get bootloader versions from bootctl status.
This avoids problems that occur in minor environments like mine.

References:  #296563
2024-07-13 09:20:13 +02:00
Florian Klink
68767b54d3
Merge pull request #321935 from Ma27/nspawn-cgroupsv2
nixos/nspawn: cgroupsv2 by default
2024-07-12 18:06:08 +03:00
Julien Malka
6701c2c867
Merge pull request #323421 from Mic92/systemd-boot-builder 2024-07-07 19:36:09 +02:00
Mitchell Skaggs
5e1481ccc7
nixos/systemd-boot: fix invalid escape sequences
This was inadvertently introduced in https://github.com/NixOS/nixpkgs/pull/281639, but was not a loud warning until Python 3.12 made invalid escape sequences a `SyntaxWarning` instead of a `DeprecationWarning` in https://github.com/python/cpython/issues/98401.
2024-07-07 05:37:08 -05:00
Franz Pletz
aa8c9e6f2d
Merge pull request #317642 from melvyn2/systemd-networkd-network-options 2024-07-04 20:21:37 +02:00
Franz Pletz
a1ecdd6b1a
Merge pull request #276135 from nbdd0121/netdev 2024-07-04 18:35:15 +02:00
Robert Hensing
7b1af67486 nixos/journald: Link to journald manpage
This creates a link to https://www.freedesktop.org/software/systemd/man/latest/journald.conf.html,
thanks to `doc/manpage-urls.json`.
2024-07-02 12:09:07 +02:00
r-vdp
d1e0f30cb2
Fix SSH in scripted initrd
Co-authored-by: Emily <vcs@emily.moe>
2024-07-01 15:35:55 +02:00
r-vdp
79d8116671
Fix ssh in initrd for systemd-initrd
Broken in https://github.com/NixOS/nixpkgs/pull/323753
2024-07-01 15:35:55 +02:00
Jörg Thalheim
ebfee308fc systemd-boot-builder: use type literals 2024-06-29 19:09:38 +02:00
Jörg Thalheim
6d0be2bec1 systemd-boot-builder: allow exceptions from python naming scheme 2024-06-29 19:09:28 +02:00
Jörg Thalheim
1ae4daa608 systemd-boot-builder: use safe run wrapper
we have a zoo of ways to call subprocesses.
Let's just replace this with one function that has reasonable defaults.
i.e. I catched instances where commands where run in a shell.
2024-06-29 19:09:06 +02:00
Jörg Thalheim
5cbf195292 systemd-boot-builder: use regex strings 2024-06-29 19:09:04 +02:00
Jörg Thalheim
f339bdf84c systemd-boot-builder: simplify conditions 2024-06-29 19:09:02 +02:00
Florian Klink
0ee2243bc8
Merge pull request #322980 from michaelfranzl/fix-nss-libvirt
nixos/virtualisation: increase priority for libvirt NSS modules
2024-06-28 18:15:16 +03:00
Jared Baur
560cd874a3
nixos/etc: fix using etc overlay on cross-compiled systems
We need to run tooling from the build platform when generating the EROFS.
2024-06-26 19:50:24 -07:00
nikstur
e05a365dca
Merge pull request #321991 from Mic92/etc-overlay-cross
etc.overlay: fix cross-build
2024-06-26 19:12:15 +02:00
Sandro
44b22d8d45
Merge pull request #318185 from tomfitzhenry/initrd-ssh-null-alg
nixos/initrd-ssh: set KexAlgorithms/Ciphers/MACs only if non-null
2024-06-25 23:21:33 +02:00
Michael Franzl
cae086d605
nixos/virtualisation: increase priority for libvirt NSS modules
When `services.resolved` is enabled, then `resolve [!UNAVAIL=return]`
is added to `system.nssDatabases.hosts` with priority 501,
which prevents lower-priority NSS modules from running
unless systemd-resolved is not available.

Quoting from `man nss-resolve`:

> To activate the NSS module, add "resolve [!UNAVAIL=return]" to the line
> starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is
> recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:"
> line. It should be before the "files" entry, since systemd-resolved
> supports /etc/hosts internally, but with caching. To the contrary, it
> should be after "mymachines", to give hostnames given to local VMs and
> containers precedence over names received over DNS. Finally, we
> recommend placing "dns" somewhere after "resolve", to fall back to
> nss-dns if systemd-resolved.service is not available.

Note that the man page (just) recommends "early" and means with this
"before the 'files' and 'dns' entries". It does not insist on being
first or excluding other modules.

For this reason, libvirt NSS modules should run before the `resolve`
module. They should come right next to `mymachines` because both are
conceptually very similar -- they resolve local VMs/containers.

Since the data source of the libvirt NSS modules are local
plain text files (see source code of the libvirt NSS module),
no performance impact is expected form this raise of priorities.

Other NSS modules in NixOS also explicitly set their priority, which is
why this change increases consistency.

Fixes #322022
2024-06-25 20:22:14 +02:00
Will Fancher
2893f56de0
Merge pull request #319359 from misuzu/clevis-zfs-fix
nixos/clevis: add support for parent encrypted zfs datasets
2024-06-24 14:47:55 -04:00
Jörg Thalheim
04efc006a4 etc.overlay: fix cross-build 2024-06-23 17:31:03 +02:00
Maximilian Bosch
749aec8444
nixos/nspawn: cgroupsv2 by default
That way you also get features like cgroup accounting for systemd units
when using systemd-nspawn w/o classic nixos containers.
2024-06-23 11:48:58 +02:00
Jared Baur
0144b6a270
nixos/switch-to-configuration: add a note for future modifications
Any future behavioral modifications to switch-to-configuration should
also be made to switch-to-configuration-ng. Leave a note at the top of
the script to ensure people don't forget.
2024-06-21 23:22:57 -07:00
Philip Taron
faa579e444
nixos/systemd-boot: guard assertion messages against eval failures
These messages should be able to be printed in all cases. In particular, trying to coerce a `null` to a string is an error unless passed through `toString`.
2024-06-18 11:30:16 -07:00
nikstur
2d15501141
Merge pull request #314579 from ivan770/etc-direct-symlinks
nixos/etc: support direct symlinks with etc overlay
2024-06-13 17:01:35 +02:00
Florian Klink
eabd9c36d9
Merge pull request #318604 from jmbaur/pref64-networkd
nixos/systemd-networkd: add PREF64 related options
2024-06-12 22:09:54 +03:00
misuzu
4df3c4c17b nixos/clevis: add support for parent encrypted zfs datasets 2024-06-12 21:21:50 +03:00
Ming-Chuan
9f488f27d7 nixos/initrd-ssh: Fix ignoreEmptyHostKeys description 2024-06-11 19:31:21 +10:00
Jared Baur
b867cc215f
nixos/systemd-networkd: add PREF64 related options 2024-06-09 20:41:32 -07:00
Tom Fitzhenry
54332f47ce nixos/initrd-ssh: set KexAlgorithms/Ciphers/MACs only if non-null
Prior to this commit, if services.openssh.settings.Macs is null, then
initrd-ssh.nix would fail to build.

Same for KexAlgorithms and Ciphers.

Noticed by @SuperSandro2000: https://github.com/NixOS/nixpkgs/pull/316934#issuecomment-2149659873
2024-06-08 15:14:26 +10:00
Pol Dellaiera
f2318b9d58
nixos/boot: use --replace-fail 2024-06-06 18:33:30 +02:00
melvyn
d4f459fa89
nixos/networkd: add new Network section options
Adds IPv4LLStartAddress, IPv4ReversePathFilter, IPv4ReversePathFilter, IPv4RouteLocalnet, and IPv4RouteLocalnet
2024-06-05 21:45:03 -07:00
Florian Klink
40066ba0d8
Merge pull request #316168 from dawidd6/systemd-user-generators
nixos/systemd: link user-generators
2024-06-05 09:59:29 +02:00
Dawid Dziurla
fbbc41f7da
nixos/systemd: simplify hooks function 2024-06-03 11:15:59 +02:00
Guillaume Girol
6ca2cfd75b
Merge pull request #313485 from tpwrules/copytoram-notif
nixos/stage-1-init: notify during copytoram
2024-06-01 21:06:33 +02:00
Dawid Dziurla
25ad0cdbfc
nixos/systemd: link user-generators 2024-05-30 19:52:22 +02:00
Dawid Dziurla
156757eaf7
nixos/systemd-user: add generators option 2024-05-30 19:51:42 +02:00
Franz Pletz
4e1b4397d9
Merge pull request #312472 from Ma27/networkd-option-rename
nixos/networkd: get rid of *Config attributes in lists
2024-05-30 04:06:01 +02:00
Jade Lovelace
e60c7e080d nixos/systemd-boot-builder: remove workaround for 10 year old Nix bug
This was originally introduced in 9245516b46,
which reveals it is a workaround for a Nix bug from 10 years ago that
was *fixed* 10 years ago.

References:
https://github.com/NixOS/nix/pull/425
https://github.com/NixOS/nixpkgs/issues/5494
2024-05-29 02:52:47 -07:00
Will Fancher
0415aec200
Merge pull request #297250 from NickCao/sysuser
nixos/systemd-sysusers: make uid/gid allocation stable
2024-05-26 20:17:06 -04:00
ivan770
1b288bca00
nixos/etc: support direct symlinks with etc overlay 2024-05-25 08:41:24 -04:00
Thomas Watson
5aa9fc9273 nixos/stage-1-init: notify during copytoram
Demystifies a long pause at an unrelated message, particularly if the
source media is slow.
2024-05-22 18:43:18 -05:00
Will Fancher
072054ccb5 nixos/systemd-stage-1: Support systemd-resolved 2024-05-21 20:55:37 -04:00
Will Fancher
154459858f nixos/systemd-resolved: Should be wanted by sysinit.target
As per its [Install] section upstream
2024-05-21 02:41:22 -04:00
Will Fancher
146bffe5aa nixos/systemd-resolved: Re-indent 2024-05-21 02:41:22 -04:00
Maximilian Bosch
c4fd7cf16d
nixos/networkd: get rid of *Config attributes in lists
This patch is about removing `wireguardPeerConfig`,
`dhcpServerStaticLeaseConfig` - a.k.a. the
AbstractSingletonProxyFactoryBean of nixpkgs - and friends.

As a former colleague said

> worst abstraction ever

I second that. I've written enough networkd config for NixOS systems so
far to have a strong dislike. In fact, these don't even make sense:
`netdevs.wireguardPeers._.wireguardPeerConfig` will be rendered into
the key `[WireGuardPeer]` and every key from `wireguardPeerConfig` is in
there. Since it's INI, there's no place where sections on the same level
as wireguardPeerConfig fit into. Hence, get rid of it all.

For the transition, using the old way is still allowed, but gives a
warning. I think we could drop this after one release.

The tests of rosenpass and systemd-networkd-dhcpserver-static-leases
were broken on the rev before, hence they were updated, but are still
not building.
2024-05-20 17:26:42 +02:00
Tom Fitzhenry
535ceaaa0e nixos/networkd: allow IPv6OnlyPreferredSec in networkd.conf
https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#IPv6OnlyPreferredSec=

https://datatracker.ietf.org/doc/html/rfc8925
2024-05-19 10:09:14 +10:00
Pol Dellaiera
aa5d9c30f8
Merge pull request #309236 from ElvishJerricco/sd-s1-fix-xfs-fsck
nixos/systemd-stage-1: Fix fsck.xfs needing bash's sh symlink
2024-05-18 23:57:04 +02:00
Fabian Möller
da68f358bc
treewide: Remove usage of pkgs.{system,hostPlatform} aliases
These aliases should not be used inside nixpkgs and are only there for backward
compatibility.
2024-05-16 11:48:32 +02:00
Pol Dellaiera
ec2ac8ec82
Merge pull request #275485 from Ex-32/binfmt-emulatedsystems-fix
nixos/binfmt: added assertion to prevent emulation of current system
2024-05-15 08:58:12 +02:00
Jared Baur
32bf051ba4
nixos/switch-to-configuration: add new implementation
This adds an implementation of switch-to-configuration that allows for
closer interaction with the lifecycle of systemd units by using DBus
APIs directly instead of using systemctl. It is disabled by default, but
can be enabled by specifying `{ system.switch = { enable = false; enableNg = true; }; }`.
2024-05-10 16:33:06 -07:00
Kylie McClain
4f96031495
nixos/boot.plymouth.font: escape font path
This fixes the usage of fonts whose filenames contain special
characters of various sorts.

For example, the setting
```nix
boot.plymouth.font =
  "${pkgs.noto-fonts}/share/fonts/noto/NotoSans[wdth,wght].ttf";
```

will cause a build failure, without this patch.
2024-05-10 15:06:10 -04:00
Florian Klink
ddf728e50b
Merge pull request #306926 from tie/networkd-global-ipv6-privacy-extensions
nixos/networkd: allow IPv6PrivacyExtensions in networkd.conf
2024-05-08 14:41:08 +03:00
Artturin
5ce6ea92e3
Merge pull request #301827 from kampka/forbiddenDependenciesRegex
nixos/top-level: Turn `system.forbiddenDependenciesRegex` into a list
2024-05-06 21:07:03 +03:00
Will Fancher
4871a4e0da nixos/systemd-stage-1: Fix fsck.xfs needing bash's sh symlink 2024-05-05 06:01:03 -04:00
Sandro Jäckel
21ab17debe
nixos/dbus: fix switching from dbus-broker to dbus 2024-05-04 21:56:17 +02:00
Christian Kampka
8814c364a3 nixos/top-level: Rename system.forbiddenDependenciesRegex to system.forbiddenDependenciesRegexes
and turn it in to a list.

The current setting of system.forbiddenDependenciesRegex is a string, meaning only one such regex as any additional setting would result in conflicts.

As maintainers have already started using this setting eg. in profiles, it would be good if this setting would accept a list of regex to allow the end
user to make use of it in addition to package maintainers.
2024-05-02 21:08:39 +03:00
Anomalocaridid
52ad64b548
nixos/grub: fix documentation for boot.loader.grub.theme (#305663)
Closes #233865. Currently, the documentation for `boot.loader.grub.theme` misleadingly implies that it needs a package for a grub theme instead of a path to a grub theme.
2024-05-02 17:43:24 +00:00
nicoo
d8e31f6617
nixos/systemd-boot: Avoid remote mypy executions (#263397) 2024-04-30 15:56:27 +00:00
Ivan Trubach
37a3ad0c01 nixos/networkd: allow IPv6PrivacyExtensions in networkd.conf
This change adds support for setting IPv6PrivacyExtensions= in
systemd.network.config.networkConfig.

https://www.freedesktop.org/software/systemd/man/latest/networkd.conf.html#IPv6PrivacyExtensions=

Added in systemd version 254.
2024-04-26 10:30:19 +03:00
Jörg Thalheim
a4a18f7b92 nixos/systemd-boot: avoid expensive mypy builds on configuration changes
* Mypy dependencies pull in quite a few packages, which makes it harder to create offline installers.
2024-04-23 20:05:26 +02:00
Florian Klink
5a2d4496d3
Merge pull request #297726 from r-vdp/systemd-unit-names
systemd: add a name option to all systemd units
2024-04-23 12:58:51 +03:00
r-vdp
9258f57625
systemd: add a name option to all systemd units
This allows us to set things like dependencies in a way that we can
catch typos at eval time.
So instead of
```nix
systemd.services.foo.wants = [ "bar.service" ];
```
we can write
```nix
systemd.services.foo.wants = [ config.systemd.services.bar.name ];
```
which will throw an error if no such service has been defined.

Not all cases can be done like this (eg template services), but in a lot
of cases this will allow to avoid typos.

There is a matching option on the unit option
(`systemd.units."foo.service".name`) as well.
2024-04-15 11:32:45 +02:00
Astrid Yu
ed854ed0e3 nixos/networkd: add [Bridge] section to netdev conf
This setting was missing from netdev.

This commit additionally adds a test using the new
section, ensuring that STP can be enabled.
2024-04-14 15:16:44 -07:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
pennae
4e21f361d6
Merge pull request #154952 from colemickens/extlinux
extlinux-conf-builder: specialisations entries
2024-04-09 18:49:08 +02:00
nikstur
4c397ea6de systemd-lib: include GPTMaxLabelLength constant 2024-04-08 16:42:25 +02:00
Florian Klink
fd61db7a32
Merge pull request #299717 from ElvishJerricco/systemd-debug-shell
nixos/systemd: Enable debug-shell.service.
2024-04-01 17:20:24 +02:00
Will Fancher
df32b558b5 nixos/systemd: Enable debug-shell.service. 2024-03-29 17:32:38 -04:00
Will Fancher
7fc25040e2
Merge pull request #277759 from onny/initrd-keyfiles
nixos/initrd-ssh: Add authorizedKeyFiles option
2024-03-29 00:24:00 -04:00
Janne Heß
fcc95ff817 treewide: Fix all Nix ASTs in all markdown files
This allows for correct highlighting and maybe future automatic
formatting. The AST was verified to work with nixfmt only.
2024-03-28 09:28:12 +01:00
Janne Heß
bc77c7a973 treewide: Mark Nix blocks in markdown as Nix
This should help us with highlighting and future formatting.
2024-03-28 09:28:12 +01:00
Will Fancher
c77e28a013
Merge pull request #298201 from philiptaron/fix-initrd-activation-with-gpt-auto
nixos/systemd/initrd: make systemd mount root as `rw` when using gpt-auto to find it
2024-03-26 18:09:33 -04:00
Sandro
c51e10cbd2
Merge pull request #283240 from Aleksanaa/nixos/plymouth
nixos/plymouth: improving documentation of logo option
2024-03-24 21:53:08 +01:00
Philip Taron
e2e43f6ce7
nixos/systemd/initrd: make systemd mount root as rw if gpt-auto is set 2024-03-22 16:08:29 -07:00
Vladimír Čunát
e90be8418d
Merge #284149: nixos/kernel: add hid_corsair to initrd modules 2024-03-22 14:59:18 +01:00
nikstur
d5d1e6a4fa
Merge pull request #297227 from WilliButz/uki/expose-rendered-config
nixos/uki: add configFile option
2024-03-20 10:41:59 +01:00
Nick Cao
e339f0a1fb
nixos/systemd-sysusers: make uid/gid allocation stable 2024-03-19 15:05:45 -04:00
Will Fancher
f0701b576a
Merge pull request #290061 from SuperSandro2000/kernel-modules-package-name
nixos/boot: move name overwrite to pkgs.aggregateModules to option
2024-03-19 13:04:19 -04:00
WilliButz
e9fa0ec5fe
nixos/uki: add configFile option
This option makes it easier to reuse a system's ukify.conf without the
need for manually calling the generator on `settings` again to receive a
rendered configuration file.

Theoretically, a complete configuration file could now be provided by
users.
2024-03-19 17:58:28 +01:00
Will Fancher
57f69255d7
Merge pull request #293591 from lf-/jade/fix-luksroot-assert
nixos.luksroot: fix assertion message to name correct option
2024-03-18 17:46:11 -04:00
Jade Lovelace
a72afcbc48 nixos.luksroot: fix assertion message to name correct option 2024-03-18 14:41:47 -07:00
Will Fancher
99587a3411
Merge pull request #209964 from Majiir/fix-initrd-systemd-closure
nixos/systemd/initrd: follow init param symlinks
2024-03-18 14:39:37 -04:00
Florian Klink
70d7abc09c
Merge pull request #296924 from flokli/document-servers-empty-fallback
nixos/timesyncd: further document services.timesyncd.servers
2024-03-18 20:08:22 +02:00
Florian Klink
78d8e2ca11 nixos/timesyncd: further document services.timesyncd.servers
Running systemd-timesyncd with an empty list of timeservers to sync from
does not work.

In case an empty list is configured here, systemd will fall back to its
compiled-in defaults, which NixOS sets to `{0..4}.nixos.pool.ntp.org`,
as per https://github.com/systemd/systemd/blob/main/docs/DISTRO_PORTING.md#ntp-pool

This has caused some confusion. Explicitly document this, and describe
how to disable timesyncd.
2024-03-18 17:23:55 +02:00
Jonas Heinrich
30036c3d10 nixos/initrd-ssh: Add authorizedKeyFiles option 2024-03-18 15:27:15 +01:00
nikstur
a1c4f0a754
Merge pull request #282022 from ElvishJerricco/gpt-auto-root
nixos: Support systemd-gpt-auto-root
2024-03-18 10:27:22 +01:00
Will Fancher
486e837cbe
Merge pull request #293710 from B4dM4n/networkd-policy-rule-port-range
nixos/networkd: allow RoutingPolicyRule port ranges
2024-03-17 12:36:30 -07:00
Will Fancher
f1731f2e28 nixos: Support systemd-gpt-auto-root 2024-03-15 18:22:04 -04:00
Arian van Putten
16526f454f nixos/binfmt: fix race condition between systemd-tmpfiles and systemd-binfmt
We need to make sure systemd-tmpfiles-setup.service ran before we
start systemd-binft.service. Otherwise it might fail to start
due to non-existant files

Fixes #295365
2024-03-12 21:08:03 +01:00
Jared Baur
2837c0d9aa
nixos/uki: add ".dtb" section if devicetree is used
This ensures a ".dtb" PE section makes it into the UKI so systemd-stub
can install the correct devicetree for use by the Linux kernel. This is
often needed on systems that boot with u-boot since the devicetree used
by u-boot is often a paired down version of what the Linux kernel needs.
On those kinds of boards, the lack of this PE section means that u-boot
will end up installing its internal devicetree into the UEFI
configuration table, which is what the Linux kernel ends up using.
2024-03-11 12:42:21 -07:00
Will Fancher
f592a7ea77
Merge pull request #293720 from vkleen/fix/systemd-boot-random-seed
nixos/systemd: Only include systemd-boot-random-seed if the unit exists
2024-03-09 21:01:35 -05:00
r-vdp
4c26c97d21
nixos/networkd: add missing UseGateway key in the DHCPv4 section 2024-03-08 10:54:03 +01:00
Viktor Kleen
0aed32b9dd
nixos/systemd: Only include systemd-boot-random-seed if the unit exists
The unit file is only present if systemd was built with bootloader support.
2024-03-08 08:52:11 +00:00
Fabian Möller
f753e58e6e
nixos/networkd: allow RoutingPolicyRule port ranges
Linux and Systemd allow port ranges to be used in routing policy rules.

https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#SourcePort=
2024-03-06 09:11:54 +01:00
r-vdp
a8ab8b59a7
systemd-boot: introduce options to set a sort-key for systemd-boot entries
Without sort-keys specified on entries, the entries are sorted only by
file name (in decreasing order, so starting at the end of the alphabet!),
without taking any other fields into account (see
[the boot loader specification reference][1]).
Moreover, entries without a sort-key are always ordered after all
entries with a sort-key, so by not adding a sort-key to the NixOS ones,
we cannot add a sort-key to any other entry while keeping it below the
NixOS entries.

So currently we have options to set the file names for additional entries like
memtest and netbootxyz.
However, as mentioned above, the sorting by file name is not very intuitive and
actually sorts in the opposite order of what is currently mentioned in the option
descriptions.

With this commit, we set a configurable sort-key on all NixOS entries,
and add options for setting the sort-keys for the memtest and netbootxyz
entries.
The sorting by sort-key is more intuitive (it starts at the start of the
alphabet) and also takes into account the machine-id and version for entries
with identical sort-keys.

We use a bootspec extension to store the sort keys, which allows us to
redefine the sort key for individual specialisations without needing any
special casing.

[1]: https://uapi-group.org/specifications/specs/boot_loader_specification/#sorting
2024-03-02 02:11:32 +01:00
nikstur
1df98b23f6
Merge pull request #292061 from nikstur/systemd-random-seed
nixos/systemd: include systemd-boot-random-seed.service
2024-03-01 21:46:39 +01:00
Silvan Mosberger
cd5dc76d83 substitute: Deprecate replacements, introduce replacementsList
Also:
- Add tests
- Treewide update
- Improve docs
2024-02-29 00:35:27 +01:00
nikstur
380f36f350 nixos/systemd: include systemd-boot-random-seed.service
This is necessary to properly refresh the boot loader random seed.
See https://www.freedesktop.org/software/systemd/man/latest/systemd-boot-random-seed.service.html#
2024-02-28 12:14:06 +01:00
nikstur
bd4c49f29b nixos/systemd: remove a superfluous override
This is already the upstream default.
2024-02-28 11:45:39 +01:00
Will Fancher
b9fe04d671
Merge pull request #291825 from WilliButz/repart/max-label-length
nixos/systemd-repart: add assertion for partition label length
2024-02-27 20:37:02 -05:00
aleksana
ec87671bd1 nixos/plymouth: improving documentation of logo option 2024-02-28 09:35:44 +08:00
Will Fancher
a587a6a357
Merge pull request #285401 from sdht0/systemd-boot-xbootldr
nixos/systemd-boot: Add support for an XBOOTLDR partition
2024-02-27 20:35:03 -05:00
Will Fancher
031978580c
Merge pull request #291882 from philiptaron/systemd-networkd/boolValuesPlus
nixos/networkd: accept `true` and `false` in addition to "yes" and "no" for DHCP= and LinkLocalAddressing=
2024-02-27 20:33:08 -05:00
Sandro
9c1ea5e3a2
Merge pull request #267012 from alois31/plymouth-unbloat
nixos/plymouth: drop the X11 renderer in the initrd
2024-02-27 22:28:27 +01:00
Philip Taron
27d6c242ea
nixos/networkd: accept true and false in addition to "yes" and "no" for DHCP= and LinkLocalAddressing=
These were the only two systemd configuration values that were missing the `boolValues ++` treatment, according to my `rg` through the codebase.
2024-02-27 08:53:32 -08:00
WilliButz
4d59ace14f
nixos/systemd-repart: add assertion for partition label length
The maximum length for a GPT label supported by systemd is 36
characters. When a repart definition contains a label that is longer
than the supported maximum length, it is ignored by systemd-repart and
a log message is produced.

The new assertion makes this obvious to the user at evaluation time,
allowing them to either drop the property entirely or choose a supported
label within the length limit instead.
2024-02-27 17:38:14 +01:00
Siddhartha
b470b4432d nixos/systemd-boot: Add support for an XBOOTLDR partition 2024-02-26 21:55:49 -05:00
Julien Malka
d882852f8b
Merge pull request #291160 from jmbaur/systemd-boot-builder-cross 2024-02-26 21:43:23 +01:00
Ryan Lahfa
077d41f9d8
Merge pull request #289856 from pennae/supfs-set
nixos/filesystems: make supportedFilesystems an attrset
2024-02-25 18:05:29 +01:00
Jared Baur
a786cc0227
nixos/systemd-boot: fix cross for lint check
Since we are not in a `callPackage` context, dependencies in
`nativeBuildInputs` don't get spliced to the buildPlatform, causing a
cross-compiled nixos system to fail at this step when running mypy built
for the hostPlatform.
2024-02-24 08:58:57 -06:00
Jörg Thalheim
87f6f1fcbd
Merge pull request #290490 from nikstur/idempotent-etc-activation
nixos/etc: make re-mounting /etc overlay idempotent
2024-02-22 07:23:22 +07:00
nikstur
5df8caced4 nixos/etc: make re-mounting /etc overlay idempotent 2024-02-21 22:54:00 +01:00
nikstur
911e22e80d
Merge pull request #288277 from WilliButz/uki/boot-counting-suffix
nixos/boot.uki: add tries option for automatic boot assessment
2024-02-20 22:50:45 +01:00
Florian Klink
8b025e80dc
Merge pull request #288690 from maralorn/drop-unused-fs-binding
nixos: Drop unused variable in systemd/initrd.nix
2024-02-20 14:12:58 +07:00
Sandro Jäckel
191e258e6c
nixos/boot: move name overwrite to pkgs.aggregateModules to option
Before there was a kernel modules path named kernel-modules which then got turned
into linux-X.X.XX-modules-shrunk. Now the unshrunk package is called linux-X.X.XX-modules
and gets turned into X.X.XX-modules-shrunk.
2024-02-20 00:13:16 +01:00
Dominik Xaver Hörl
97d6166176 nixos/etc: fix payload in build-composefs-dump for the file case 2024-02-19 23:27:34 +01:00
pennae
258b935d70 nixos/filesystems: make supportedFilesystems an attrset
this lets us *dis*able filesystem explicitly, as is required by e.g. the
zfs-less installer images. currently that specifically is only easily
possible by adding an overlay that stubs out `zfs`, with the obvious
side-effect of also removing tooling that could run without the kernel
module loaded.
2024-02-19 11:46:52 +01:00
Majiir Paktu
58a373809a nixos/systemd/initrd: follow init param symlinks 2024-02-18 14:57:12 -05:00
Adam Stephens
1012b2a368 nixos/boot/kernel: add kernelPatches example of using kernel mailing list mbox url 2024-02-17 21:21:52 +11:00
WilliButz
fbaf7446ec
nixos/boot.uki: add tries option for automatic boot assessment
See https://uapi-group.org/specifications/specs/boot_loader_specification/#boot-counting
and https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT/ .

Related to #284135.
2024-02-16 11:31:40 +01:00
Jade Lovelace
5d1feba540 nixos/systemd.oomd: set the memory pressure thresholds as mkDefault
These should be defaults as they're pretty reasonable to want to
override as a user. Unsure how to change the slice defaults to be
overridable, that should probably be a later conversation.
2024-02-15 09:41:26 -08:00
Michele Guerini Rocco
c1f27ae1d3
Merge pull request #199515 from MangoIV/mangoiv/add-note-to-boot-initrd-secrets
Add documentation for moved secrets in stage 1
2024-02-14 14:35:04 +01:00
maralorn
6634b86601 nixos: Drop unused variable in systemd/initrd.nix 2024-02-14 01:22:58 +01:00
nikstur
4d2c5b722a
Merge pull request #285114 from WilliButz/improve-uki-settings-merging
nixos/boot.uki: allow partial overrides of default UKI settings
2024-02-08 21:15:08 +01:00
Will Fancher
ee9becfdfb
Merge pull request #285315 from jmbaur/sysupdate-fixes
nixos/sysupdate: allow lists in sysupdate config
2024-02-07 03:01:49 -05:00
Florian Klink
7c0a129076
Merge pull request #256652 from giorgiga/rateLimitBurst-documentation
Clarify journal size limit defaults in documentaiton of services.journald.rateLimitBurst
2024-02-06 13:26:35 +01:00
Linus Heckemann
9f571cb4ef
Merge pull request #284508 from nikstur/etc-overlay-leading-slash
nixos/etc: remove leading slash from paths
2024-02-03 18:01:01 +01:00
Nick Cao
0850ee016b
nixos/networkd: drop upstreamed stage-1 unit dependencies
Reference: https://github.com/systemd/systemd/pull/27791
2024-01-31 22:52:52 -05:00
Jared Baur
50866dc20f
nixos/sysupdate: allow lists in sysupdate config
Lists are convenient to have in sysupdate configuration when using
multiple `MatchPattern` under `Target` when the target can have multiple
filenames. This use-case is helpful for BootLoaderSpec bootcounting where the target file on
disk can have multiple filenames, and in order for sysupdate to properly
ensure only N number of instances of this target exist at one time, we
need to have multiple match patterns.
2024-01-31 09:12:28 -08:00
Jörg Thalheim
202e697233 nixos/systemd-boot: fix editor option 2024-01-31 10:46:30 +07:00
WilliButz
ccff749532
nixos/boot.uki: allow partial overrides of default UKI settings
Previously any user-provided config for boot.uki.settings would need to
either specify a full set of config for ukify or a combination of
mkOptionDefault to merge the "settings" attribute set with the module's
defaults and then mkOverride or mkForce to override a contained
attribute.

Now it is possible to trivially override parts of the module's default
config, such as the initrd or kernel command line, but overriding the
full set of settings now requires mkOverride / mkForce.
2024-01-30 23:54:40 +01:00
nikstur
a9161ceb5a nixos/etc: remove leading slash from target paths in build-composefs-dump.py
This is necessary so that duplicates in the composefs dump are avoided.
2024-01-28 13:37:23 +01:00
Will Fancher
6f1b17d4b8 systemd-stage-1: Fix hibernate-resume with systemd v255 2024-01-28 06:52:21 -05:00
nikstur
92b98478a8 nixos/etc: fix type checking of build-composefs-dump.py 2024-01-28 01:58:56 +01:00
Julien Malka
ceeddc5b15 nixos/systemd-boot: move builder script in bin folder 2024-01-27 01:29:40 +00:00
Lorenz Brun
b8b53fdf37 nixos/kernel: add hid_corsair to initrd modules
Same as all the other HID drivers, otherwise Corsair keyboards do not
work before the switch to stage2 without custom configuration.
2024-01-27 02:11:57 +01:00
Will Fancher
0d85bf0efe nixos/systemd: Temporarily bring back multi-user -> network-online
There were several modules, critically including NetworkManager, which
were not prepared for this change. Most of the change was good,
however. Let's bring back the dependency and change the assertion to a
warning for now.
2024-01-25 15:53:52 -05:00
github-actions[bot]
8c2ba7797a
Merge master into staging-next 2024-01-25 12:01:19 +00:00
Julien Malka
39a2e0bb03
Merge pull request #283396 from newAM/clevis-clarify 2024-01-25 08:52:44 +01:00
github-actions[bot]
5af80acc9a
Merge master into staging-next 2024-01-25 06:01:04 +00:00
Jörg Thalheim
559ddda570
Merge pull request #279852 from Madouura/pr/bcachefs
bcachefs: update comments, release-notes, only use IFS for bcachefs, update bcachefs-tools and module
2024-01-25 01:11:04 +01:00