Commit graph

2074 commits

Author SHA1 Message Date
Vincent Haupert bc8d6d8f96 nixos/networkd: DHCPv6PrefixDelegation -> DHCPPrefixDelegation
Adapt to changes introduced in Systemd 250:

> The [DHCPv6PrefixDelegation] section in .network file is renamed to
> [DHCPPrefixDelegation], as now the prefix delegation is also
> supported with DHCPv4 protocol by enabling the Use6RD= setting.

Replaces the `dhcpV6PrefixDelegationConfig` with
`dhcpPrefixDelegationConfig` and throws an error if the old option is
used.

Also adapt the respective IPv6 prefix delegation test.
2022-10-09 00:11:52 +02:00
Lin Jian 437f73dd54
nixos/systemd-boot: fix entry match condition in remove_old_entries
Before this patch, the entry match condition always fails, causing all
entries being removed. The error is not noticed because later they are
re-generated.
2022-10-07 20:43:48 +08:00
Lin Jian 642323930e
nixos/systemd-boot: correctly find gen_number for specialisation
Before this patch, the gen_number found by regex contains
"-specialisation-foo" if specialisation is used. As a result, applying
int() to gen_number raises ValueError, causing entries containing
a specialisation part not being removed.
2022-10-07 19:28:43 +08:00
Cole Mickens 3d5d6fc78c
nixos: luksroot: toString-ify keyFileSize usage 2022-10-06 15:06:50 -07:00
Zhaofeng Li b9b454820a systemd/initrd: Add TPM modules into initrd
This improves the out-of-box experience of TPM2 unlocking at a
small (50K) overhead.
2022-10-05 08:22:53 -06:00
Zhaofeng Li 21bbef9548 nixos/luksroot: Reword message on FIDO2 support with systemd stage 1 2022-10-05 08:22:53 -06:00
Zhaofeng Li 19c34ac44b systemd/initrd: Add files required by TPM2 and FIDO2 support to the initramfs 2022-10-05 08:22:14 -06:00
Zhaofeng Li 570824e102 systemd: Wrap in LUKS2 tokens
Update pkgs/os-specific/linux/systemd/default.nix

Co-authored-by: Janne Heß <janne@hess.ooo>
Co-authored-by: Ilan Joselevich <personal@ilanjoselevich.com>
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2022-10-05 08:22:14 -06:00
github-actions[bot] 855f2990f1
Merge staging-next into staging 2022-10-05 12:02:14 +00:00
Florian Klink c1c406bc87
Merge pull request #191491 from oxalica/fix/systemd-initrd-modprobe
nixos/systemd-stage-1: include modprobe confg in initrd
2022-10-05 10:39:58 +02:00
github-actions[bot] d426366b62
Merge staging-next into staging 2022-10-05 00:05:03 +00:00
Scott Bronson 4db7061162
Sort the /etc/.clean file
Without sorting, the contents of /etc/.clean are likely to change on
every nixos-rebuild due to Perl's nondeterministic hash key ordering.
2022-10-03 14:11:17 -07:00
Gabriel Arazas 292aab9822 nixos/systemd: update extraConfig description 2022-10-03 11:17:41 +08:00
phaer fcd5087046 systemd: build with portabled by default. 2022-09-30 14:53:50 +02:00
Robert Hensing d1f0a6d972 nixos/systemd/oomd: mdDoc fix 2022-09-28 16:07:42 +02:00
Bernardo Meurer 2e0cca58f0
Merge pull request #169613 from helsinki-systems/feat/systemd-oomd 2022-09-28 09:53:49 -03:00
Franz Pletz 1f41992899
Merge pull request #187073 from penglei/master 2022-09-27 05:33:22 +02:00
Sandro Jäckel 03b6d5111a
nixos/systemd: remove not required or true 2022-09-19 13:45:01 +02:00
oxalica c5c42d4fbe nixos/systemd-stage-1: include modprobe confg in initrd 2022-09-16 20:54:04 +08:00
Yureka 19686a4452 nixos/systemd: conditionally include systemd-update-utmp upstream unit 2022-09-13 10:34:28 +02:00
Christian Kögler cfbf9bd15c nixos/nspawn: Fix configuration name PrivateUsersOwnership
Fix #189046
2022-09-11 13:08:36 +02:00
Christian Kögler 0ea763fab6
Merge pull request #188009 from martiert/fido2luks
nixos/luksroot: Support adding a list of credentials to fido2luks
2022-09-11 07:42:57 +02:00
pennae d98322834b nixos/*: fix docbook deprecation notices
mostly no rendering changes except in buildkite, which used markdown
where docbook was expected without marking up its markdown.
2022-09-10 18:23:13 +02:00
Christian Kögler d44b9d665c
Merge pull request #189201 from jmbaur/ipv6-route-prefix-example
nixos/systemd.network: Fix `ipv6RoutePrefixes` example
2022-09-09 17:05:36 +02:00
Christian Kögler 7d731f3bca nixos/nspawn: Remove not compliant options
The attribute set sharedOptions pulls in not compliant unit options:
- requiredBy
- wantedBy
- aliases

see man5 systemd.nspawn
2022-09-05 17:01:23 +02:00
penglei 6393cb765e nixos/boot/stage-1-init: umount /findiso in stage-1 2022-09-05 08:59:29 +08:00
pennae 3bddcf5f90
Merge branch 'master' into option-docs-md 2022-09-01 16:10:09 +02:00
Martin Ertsås 5e4921013b nixos/luksroot: Support adding a list of credentials to fido2luks
This adds support for using multiple fido2 keys for luks decryption
2022-09-01 08:55:46 +02:00
Jared Baur 51a1c73542 nixos/systemd.network: Fix ipv6RoutePrefixes example
The example doesn't have the top-level attribute `ipv6RoutePrefixConfig`
in each attrset of the list.
2022-08-31 17:04:18 -07:00
pennae 1d41cff3dc nixos/*: convert straggler options to MD 2022-08-31 17:27:38 +02:00
pennae f2ea09ecbe nixos/*: convert options with listings
minor rendering changes.
2022-08-31 17:27:36 +02:00
pennae 722b99bc0e nixos/*: convert options with admonitions to MD
rendering changes only slightly, most changes are in spacing.
2022-08-31 16:36:16 +02:00
pennae bd56368848 nixos/*: md-convert hidden plaintext options
most of these are hidden because they're either part of a submodule that
doesn't have its type rendered (eg because the submodule type is used in
an either type) or because they are explicitly hidden. some of them are
merely hidden from nix-doc-munge by how their option is put together.
2022-08-31 16:32:54 +02:00
pennae 515c4727fa nixos/*: md-"convert" empty descriptions
for some reason these are not picked up properly by nix-doc-munge, so
we'll do this instead.
2022-08-31 16:32:54 +02:00
pennae 9547123258 nixos/*: convert internal option descriptions to MD
we'll have to do it eventually, may as well be now.
2022-08-31 16:32:54 +02:00
pennae ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae c915b915b5 nixos/*: md-convert options with unordered lists
mostly no rendering changes. some lists (like simplelist) don't have an
exact translation to markdown, so we use a comma-separated list of
literals instead.
2022-08-31 16:32:53 +02:00
pennae 0cfcb5908c nixos/*: <screen> -> <programlisting>
most of the screen tags used in option docs are actually listings of
some sort. nsd had a notable exception where its screen usage was pretty
much a raw markdown block that made most sense to convert into docbook lists.
2022-08-31 16:27:24 +02:00
pennae 5841c386a0 nixos/*: remove indentation from long enable options
the way these are written they introduce lots of whitespace in each
line, which will cause those lines to render as code when converted to
markdown. override the whole description instead.
2022-08-31 16:21:14 +02:00
Janne Heß 3284f4fa19
nixos/systemd-oomd: Add a new module + test 2022-08-31 13:24:32 +02:00
Will Fancher 78e892c44d
Merge pull request #187222 from winterqt/systemd-boot-esp-path
nixos/systemd-boot: use esp-path instead of path when calling bootctl
2022-08-30 12:57:40 -04:00
Florian Klink 087fa6565d
Merge pull request #184340 from jmbaur/ipv6routeprefix
nixos/systemd.network: Add `IPv6RoutePrefix` options
2022-08-30 11:10:47 +02:00
pennae 51a11254a7 nixos/*: literalDocBook -> literalMD
no change to rendered output
2022-08-27 19:18:29 +02:00
Will Fancher 037cf37ad2
Merge pull request #185085 from ElvishJerricco/shutdown-ramfs-protection
shutdown: Protect system from make-initrd-ng
2022-08-26 13:25:31 -04:00
Martin Weinelt 2ae8a945fb
Merge pull request #188309 from Sohalt/systemd-networkd-dhcpserver-missing-options 2022-08-26 11:50:50 +02:00
sohalt 8b74b21d23 nixos/networkd: add missing options for DHCPServer and IPV6SendRA 2022-08-26 11:42:58 +02:00
Martin Weinelt e7454ee38b
Merge pull request #187444 from peigongdsd/test 2022-08-26 08:17:46 +02:00
Stig 8c4a3b279b
Merge pull request #186503 from Weathercold/patch-1
nixos/switch-to-configuration: fix units starting with dash not being able to reload
2022-08-21 17:31:52 +02:00
Will Fancher 2239c5d55f
Merge pull request #186163 from lilyinstarlight/feature/systemd-stage-1-fs-label
nixos/systemd-stage-1: unify initrd fstab generation logic with system fstab
2022-08-20 18:29:07 -04:00
pennae 6039648c50 nixos/*: automatically convert option docs 2022-08-19 22:40:58 +02:00
pennae 7e7d68a250 nixos/*: mark pre-existing markdown descriptions as mdDoc 2022-08-19 22:40:58 +02:00
pennae e4ed177f82 nixos/* eliminate inner whitespace in tags that was missed earlier
nix-doc-munge won't match tags that contain newlines anywhere. most of
these have already been removed, but a few obviously made it through.
2022-08-19 22:40:58 +02:00
peigongdsd 506cb62c4e modified: nixos/modules/system/boot/networkd.nix 2022-08-19 21:00:18 +08:00
peigongdsd 90de9ee689 nixos/modules/system/boot/networkd.nix: added Group= option in sectionLink of systemd.networkd config
see also: systemd.network(5)
2022-08-19 20:53:08 +08:00
Lily Foster 69d7943101 nixos/systemd-stage-1: unify initrd fstab generation logic with system fstab 2022-08-18 13:33:43 -04:00
Winter 771ef9f738 nixos/systemd-boot: use esp-path instead of path when calling bootctl
`path` has been aliased to `esp-path` for over 3 years (see fbf45d22da).
2022-08-18 01:08:07 -04:00
Jared Baur 4f58def5e6
Merge branch 'NixOS:master' into ipv6routeprefix 2022-08-17 15:08:31 -07:00
Weathercold 8fb63401af
nixos/switch-to-configuration: fix units starting with dash
Fix units starting with `-` being recognized as options.
2022-08-12 18:36:15 -04:00
pennae 50f9b3107a
Merge pull request #185474 from pennae/option-docs-md
nixos/*: more options md conversion
2022-08-12 23:23:26 +02:00
Sergei Trofimovich 925a9bb753
Merge pull request #185530 from trofi/restore-stage-1-strip
nixos/stage-1: srestore striping of bin/ and lib/
2022-08-11 08:50:45 +01:00
Jörg Thalheim 5a436f538f
Merge pull request #179619 from Informatic/plymouth-systemd-stage1-themes
nixos/plymouth: fix theme dependency resolution in systemd stage 1
2022-08-11 08:38:33 +01:00
Janne Heß 1120326a5b
Merge pull request #185067 from stigtsp/refactor/stc-no-net-debus
nixos/switch-to-configuration: replace Net::DBus with busctl
2022-08-09 20:28:49 +02:00
Robert Hensing 661c29c806
Merge pull request #181222 from hercules-ci/module-specialArgs
`_module.specialArgs` + unit test for nixos/documentation module
2022-08-08 11:53:10 +02:00
Sergei Trofimovich fb324910bf nixos/stage-1: srestore striping of bin/ and lib/
commit 0507725061 ("setup-hooks/strip.sh: run RANLIB on static
archives after stripping") added an extra argument to `stripDirs()`
helper.

I did not realize it's used outside the strip hook itself. Restore
stripping by passing $RANLIB as a new argument.
2022-08-07 11:05:29 +01:00
pennae 087472b1e5 nixos/*: automatically convert option docs 2022-08-06 20:39:12 +02:00
Bernardo Meurer 5b3a9a815d
Merge pull request #185089 from NickCao/bind
nixos/stage-1-systemd: fix initrd-fstab generation for bind mounts
2022-08-05 14:25:11 -07:00
pennae 423545fe48 nixos/*: normalize manpage references to single-line form
now nix-doc-munge will not introduce whitespace changes when it replaces
manpage references with the MD equivalent.

no change to the manpage, changes to the HTML manual are whitespace only.
2022-08-05 18:34:50 +02:00
pennae 93c57a9884
Merge pull request #185056 from pennae/option-docs-md
nixos/*: more option docs conversions
2022-08-05 17:36:49 +02:00
Christian Kögler 04d94dc8ff
Merge pull request #183897 from amarshall/networkd-fix-ipv6prefixes-example
nixos/networkd: Fix some invalid examples
2022-08-04 23:02:40 +02:00
Sandro 6c55138d9b
Merge pull request #184786 from danc86/fido2luks-discard 2022-08-04 15:08:58 +02:00
Dan Callaghan da26caad10
nixos/luksroot: allow discards with fido2luks 2022-08-04 19:32:14 +10:00
Nick Cao ce39bee9dd
nixos/stage-1-systemd: fix initrd-fstab generation for bind mounts 2022-08-04 10:26:37 +08:00
Will Fancher a454a706b5 shutdown: Protect system from make-initrd-ng 2022-08-03 22:18:47 -04:00
Stig Palmquist 4c2764c69c
nixos/switch-to-configuration: replace Net::DBus with busctl
Call dbus by using `$cur_systemd/busctl --json=...` and core modules
JSON::PP and IPC::Cmd to slim down dependencies for baseSystem.

perlPackages.NetDBus pulls in quite a few other dependencies, like
XML::Twig, LWP, and HTTP::Daemon. These are not really neccecary for
s-t-c, and some of them have caused issues particularly with cross
builds after updates to perlPackages.
2022-08-04 00:08:26 +02:00
pennae 61e93df189 nixos/*: automatically convert option docs to MD
once again using nix-doc-munge (69d080323a)
2022-08-03 22:46:41 +02:00
pennae 3aebb4a2be nixos/*: normalize link format
make (almost) all links appear on only a single line, with no
unnecessary whitespace, using double quotes for attributes. this lets us
automatically convert them to markdown easily.

the few remaining links are extremely long link in a gnome module, we'll
come back to those at a later date.
2022-08-03 21:57:46 +02:00
pennae 9c8531c8a5 nixos/*: replace <replaceable>s with «thing»
we can't embed syntactic annotations of this kind in markdown code
blocks without yet another extension. replaceable is rare enough to make
this not much worth it, so we'll go with «thing» instead. the module
system already uses this format for its placeholder names in attrsOf
paths.
2022-08-03 21:08:58 +02:00
pennae 694d5b19d3 nixos/*: replace </para><para> with double linebreaks
our xslt already replaces double line breaks with a paragraph close and
reopen. not using explicit para tags lets nix-doc-munge convert more
descriptions losslessly.

only whitespace changes to generated documents, except for two
strongswan options gaining paragraph two breaks they arguably should've
had anyway.
2022-08-03 20:39:21 +02:00
K900 eabbad8af1
Merge pull request #185036 from K900/goblinization
make-initrd-ng: parse ELFs ourselves instead of shelling out to patchelf and friends
2022-08-03 19:57:55 +03:00
Janne Heß bc7ff29bdf
Merge pull request #184822 from snpschaaf/networkd-link-add-promiscious
add Promiscuous as valid value for linkConfig
2022-08-03 11:05:32 +02:00
Philippe Schaaf d5e7f6a613 add Promiscuous as valid value for linkConfig
configuring a network via
`systemd.network.networks.<name>.linkConfig`
does not allow to set the attr Promiscuous = "true";

This referes to:
https://www.freedesktop.org/software/systemd/man/systemd.network.html#Promiscuous=

Signed-off-by: Philippe Schaaf <philippe.schaaf@secunet.com>
2022-08-03 09:05:42 +02:00
Vladimír Čunát a0ebaa7431
Merge #183748: staging-next 2022-07-29 2022-08-03 09:04:16 +02:00
Florian Klink dfda3c3e04
Merge pull request #182577 from squalus/coredump
nixos: systemd-coredump: improve disabled state
2022-08-03 13:32:11 +07:00
Linus Heckemann 6fc909a1cc makeInitrdNG: make stripping fully optional
Now the tool will only strip binaries if a strip executable is passed
via the STRIP environment variable. This is exposed via the strip
option for makeInitrdNG and the NixOS option boot.initrd.systemd.strip.
2022-08-02 10:19:48 +03:00
github-actions[bot] 0f0010fda3
Merge master into staging-next 2022-08-02 06:02:34 +00:00
squalus 257db1dd4a nixos: systemd-coredump: improve disabled state
The systemd-coredump module required systemd to be built with
withCoredump=true, even if the module was disabled.

- allow systemd to be missing systemd-coredump if the module is disabled
- switch to mkDefault for the sysctl config to allow user overrides when
  the module is disabled
- add nixos tests for both the enabled and disabled cases
2022-08-01 09:52:56 -07:00
Jared Baur b1bb3bcad8 nixos/systemd.network: Add IPv6RoutePrefix options 2022-07-31 14:11:01 -07:00
pennae 2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Andrew Marshall 51adf865a3 nixos/networkd: Fix example for dhcpServerStaticLeaseOptions option
The example was not valid, and would raise an error.
2022-07-30 00:55:56 -04:00
Andrew Marshall a9fbd07f56 nixos/networkd: Fix example for ipv6Prefixes option
The example was not valid, and would raise an error.
2022-07-30 00:55:56 -04:00
github-actions[bot] c5298a170d
Merge staging-next into staging 2022-07-27 18:02:13 +00:00
pennae a16b25432e
Merge pull request #182685 from pennae/invariant-option-conversions
treewide: invariant option conversions to MD
2022-07-27 15:39:47 +02:00
github-actions[bot] 52e7c12c41
Merge staging-next into staging 2022-07-26 06:02:58 +00:00
Jared Baur 777e914c20 nixos/systemd.network: Add RequiredFamilyForOnline to linkConfig
While writing a configuration, I found a usage for this field and
noticed it was missing when building the configuration.
2022-07-26 04:11:33 +02:00
github-actions[bot] 4a6e124c33
Merge staging-next into staging 2022-07-24 12:02:06 +00:00
pennae ff56c775c8
Merge pull request #182098 from pennae/option-doc-md
convert some varlists in option docs to MD
2022-07-24 13:14:40 +02:00
pennae 860a0449ce nixos/system: invariant option docs MD conversions 2022-07-24 13:01:47 +02:00
github-actions[bot] b4832bac52
Merge staging-next into staging 2022-07-22 15:34:59 +00:00
Maximilian Bosch 779853b52b
Merge pull request #182413 from NetaliDev/pam-mount-fix-refactor
nixos/pam: refactor pam_mount unmounting fix
2022-07-22 14:05:44 +02:00
github-actions[bot] dec2508b80
Merge staging-next into staging 2022-07-22 12:02:21 +00:00
Florian Klink 7c119675a3
Merge pull request #179002 from klemensn/move-passwdEntry-type
move passwdEntry type
2022-07-22 14:16:57 +07:00
K900 c9183d3738 nixos/systemd: make sure all the device nodes are created in stage1
The ConditionFileNotEmpty override patch wasn't correct for stage1, which
does have the modules in /lib. So, remove the patch and set
the right path with overrides in the final system.

Also, make sure systemd-tmpfiles-setup-dev is pulled in to create
all the necessary symlinks.
2022-07-22 10:01:21 +03:00
Netali 93132dc09c
nixos/pam: refactor pam_mount unmounting fix 2022-07-22 04:17:14 +02:00
Robert Hensing ec3e1c6a3a nixos/documentation: Remove systemd/initrd dependency
Working towards a unit-testable documentation module.
2022-07-21 15:32:10 +02:00
pennae 7388711363 nixos/resolved: convert option docs to MD 2022-07-19 16:23:57 +02:00
Sandro Jäckel 4396fd615c
nixos/systemd-boot: remove default log message if nothing changes 2022-07-17 21:46:50 +02:00
Bernardo Meurer c6b0888a86
Merge pull request #180991 from aij/raspberrypi-bootloader-config.txt
raspberrypi-bootloader: Update doc URL for config.txt options
2022-07-10 14:09:43 -07:00
Sandro 366683965e
Merge pull request #166308 from ncfavier/wg-resolvconf
nixos/resolvconf: allow different implementations
2022-07-10 21:00:00 +02:00
Ivan Jager 34aa4fe7a9 raspberrypi-bootloader: Update doc URL for config.txt options
The old URL was redirecting to more generic Rasbperry Pi documentation.
2022-07-10 06:58:32 -05:00
Et7f3 6b820ecfab
nixos: systemd: add missing sliceToUnit (#179841)
Seem to be omitted in 022b4209a3 (diff-5ea4693beb4bdd8f7efcdd3204ceea67c86f59b3d1c28cde063ddf03e1d20fbfL29).
2022-07-02 18:56:53 +03:00
Piotr Dobrowolski 348b88545c nixos/plymouth: fix theme dependency resolution in systemd stage 1
Some plymouth themes use assets of others, like is the case with our
default bgrt depending on spinner. Missing assets would cause the
splashscreen to not render at all in stage 1.

Preliminary dependency resolution code seemed to be broken, and this
should fix it.

Only direct dependencies of selected theme are pulled in.
2022-06-29 21:38:34 +02:00
Klemens Nanni 30c36b4706 nixos/systemd-stage-1: use types.passwdEntry in emergencyAccess
`boot.initrd.systemd.emergencyAccess` expects passwd(5) formatted
strings, hence `singleLineStr` is too broad.

Use the same type as `users.users.*.hashedPassword` to ensure
consistency across all options where password hashes are used.

From `modules/config/users-groups.nix`:
```
       hashedPassword = mkOption {
         type = with types; nullOr (passwdEntry str);
       ...
       };
```
2022-06-25 16:34:49 +04:00
Naïm Favier 203696f098
nixos/resolvconf: add package
Expose the package that provides the system-wide `resolvconf` command
(either openresolv or systemd) to allow implementation-agnostic modules.
2022-06-21 22:58:43 +02:00
Sandro Jäckel 3df045e6d5
nixos/systemd: use cfg.package in systemPackages to avoid confusion 2022-06-09 22:44:28 +02:00
Matthias Treydte ff24f484af nixos/systemd-boot: fix systemd-boot-builder refusing to update
Handling of the string length condition in should_update
was broken, as evident with the log message

> leaving systemd-boot 246 in place (250.4 is not newer)

Discussion with @mweinelt came to the conclusion
that Python's "<" operator already does what we need,
so the should_update function can be dropped.

Fixes a30de3b849
2022-06-01 11:49:07 +02:00
Florian Klink f12a263b69
Merge pull request #172707 from klemensn/init-zfs-mount-options
nixos/stage-1: Fix library path in libraries, fix ZFS mount options
2022-05-30 10:51:17 +02:00
Matthias Treydte a30de3b849 nixos/systemd-boot: fix systemd-boot-builder dowgrade to fail
Since, 4ddc78818e systemd-boot-builder
is broken in two ways:

  * if no systemd-boot is currently installed *and* the NIXOS_INSTALL_BOOTLOADER
    env variable is not set, it will try to run "bootctl update", which will fail
  * if the currently installed systemd-boot version is newer than the version
    we're about to install, it will also try to run "bootctl update", which will fail

This patch changes the behaviour,

  * for the first case to still fail, but not even bother to try running
    "bootctl update" and instead erroring out with an exception
  * for the second case to leave the newer version in place, restoring
    the pre - 4ddc78818e behaviour

To do the proper version check a new "should_update" helper function was introduced,
mimicing the compare_product C function from bootctl. If the following systemd
issue gets resolved, we would have a nice way to get rid of this function:

> https://github.com/systemd/systemd/issues/23450

This change allows to again switch to a different NixOS configuration which contains
an older systemd-boot.

Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com>
2022-05-28 13:18:21 +02:00
Klemens Nanni 9eb704b65a nixos/stage-1: Zap no longer needed LD_LIBRARY_PATH
The previous commit properly adjusts all library paths, thus no need to
forcefully adjust the path at runtime any longer.
2022-05-26 22:17:02 +02:00
Klemens Nanni d33e52b253 nixos/stage-1: Fix library path in libraries also
`extra-utils` composes the set of programs and libraries needed by

1. copying over all programs
2. copying over all libraries any program directly links against
3. set the runtime path for every program to the library directory

It seems that this approach misses the case where a library itself links
against another library.  That is to say, `extra-utils` assumes that
either only progams link against libraries or that every library linked
to by a library is already linked to by a program.

`mount.zfs` linking against `libcrypto`, in turn linking against `libdl`
shows how the current approach falls short:

```
$ objdump -p $(which mount.zfs) | grep NEEDED | grep -e libdl -e libcrypto
  NEEDED               libcrypto.so.1.1
$ ldd (which mount.zfs) | grep libdl
        libdl.so.2 => /nix/store/ybkkrhdwdj227kr20vk8qnzqnmj7a06x-glibc-2.34-115/lib/libdl.so.2 (0x00007f9967a9a000
```

Using `mount.zfs` directly in stage 1 init still works since
`LD_LIBRARY_PATH` overrides this (as intended).

util-linux's `mount` however executes `mount.zfs` with LD_LIBRARY_PATH
removed from its environment as can be seen with strace(1) in an
interactive stage 1 init shell (`boot.shell_on_fail` kernel parameter):

```
 # env -i LD_LIBRARY_PATH=$LD_LIBRARY_PATH $(which strace) -ff -e trace=/exec -v -qqq $(which mount) /mnt-root
execve("/nix/store/3gqbb3swgiy749fxd5a4k6kirkr2jr9n-extra-utils/bin/mount", ["/nix/store/3gqbb3swgiy749fxd5a4k"..., "/mnt-root"], ["LD_LIBRARY_PATH=/nix/store/3gqbb"...]) = 0
[pid  1026] execve("/sbin/mount.zfs", ["/sbin/mount.zfs", "<redacted>", "/mnt-root", "-o", "rw,zfsutil"], []) = 0
/sbin/mount.zfs: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1026, si_uid=0, si_status=127, si_utime=0, si_stime=0} ---
```

env(1) is used for clarity (hence subshells for absoloute paths).

While `mount` uses the right library path, `mount.zfs` is stripped of
it, so ld.so(8) fails resolve `libdl` (as required by `libcrypto`).

To fix this and not rely on `LD_LIBRARY_PATH` to be set, fix the library
path inside libraries as well.

This finally mounts all ZFS filesystems using `zfsutil` with correct and
intended mount options.
2022-05-26 22:17:02 +02:00
Klemens Nanni 4b045c7066 nixos/stage-1: Remove redundant symlink check
find(1)'s test `-type f` already excludes symbolic links, so `test -L`
will never return false for found files.
2022-05-26 22:17:02 +02:00
Klemens Nanni de77849ad6 nixos/stage-1: Account for hardcoded executable paths
At least pkgs/os-specific/linux/util-linux/default.nix uses
```
    "--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin"
```

which does not cover stage 1 init's PATH as all executables are put
under /bin/.

Fix util-linux's `mount` usage by symlinking /sbin to it.
2022-05-26 22:17:02 +02:00
Klemens Nanni 9553106832 nixos/stage-1: Ensure correct ZFS mount options
Consider ZFS filesystems meant to be mounted with zfs.mount(8), e.g.
```
config.fileSystems."/media".options = [ "zfsutil" ];
config.fileSystems."/nix".options = [ "zfsutil" ];
```

`zfsutil` uses dataset properties as mount options such that zfsprops(7)
do not have to be duplicated in fstab(5) entries or manual mount(8)
invocations.

Given the example configuation above, /media is correctly mounted with
`setuid=off` translated into `nosuid`:

```
$ zfs get -Ho value setuid /media
off
$ findmnt -t zfs -no options /media
rw,nosuid,nodev,noexec,noatime,xattr,posixacl
```

/nix however was mounted with default mount(8) options:
```
$ zfs get -Ho value setuid /nix
off
$ findmnt -t zfs -no options /nix
rw,relatime,xattr,noacl
```

This holds true for all other ZFS properties/mount options, including
`exec/[no]exec`, `devices/[no]dev`, `atime/[no]atime`, etc.

/nix is mounted using BusyBox's `mount` during stage 1 init while /media
is mounted later using proper systemd and/or util-linux's `mount`.

Tracing stage 1 init showed that BusyBox never tried to execute
mount.zfs(8) as intended by `zfsutil`.

Replacing it with util-linux's `mount` and adding the mount helper
showed attempts to execute mount.zfs(8).

Ensure ZFS filesystems are mounted with correct options iff `zfsutil` is
used.
2022-05-26 22:16:53 +02:00
Martin Weinelt 6d8f8a7b46
Merge pull request #174090 from helsinki-systems/fix/plymouth
nixos/plymouth: Fix non-systemd initrd boot
2022-05-23 17:08:02 +02:00
Janne Heß 2cc4bf9427
nixos/plymouth: Fix non-systemd initrd boot 2022-05-23 11:17:21 +02:00
Klemens Nanni cbcc746f8f nixos/systemd: Package only built component units
Account for all `with*` options causing their respective unit files to
not be built, just like the current code `withCryptsetup` already does.

This fixes build errors like the following:
```
missing /nix/store/5fafsfms64fn3ywv274ky7arhm9yq2if-systemd-250.4/example/systemd/system/systemd-importd.service
error: builder for '/nix/store/67rdli5q5akzwmqgf8q0a1yp76jgr0px-system-units.drv' failed with exit code 1
```

Found by using a customised systemd package as follows:
```
systemd.package = pkgs.systemd-small;

nixpkgs.config.packageOverrides = pkgs: {

  "systemd-small" = pkgs.systemd.override {
    withImportd = false;
    withMachined = false;
    ...
  };

};
```
2022-05-16 16:52:25 +02:00
Alyssa Ross 85d792a928
nixos: don't put non-firmware in hardware.firmware
These two packages don't have a lib/firmware directory, so putting
them in hardware.firmware has no effect.  This will become a hard
error once firmware compression is implemented.

(In the case of Linux, the firmware was all moved to linux-firmware.)
2022-05-12 15:17:51 +00:00
Janne Heß e6fb1e63d1
Merge pull request #171650 from helsinki-systems/feat/config-systemd-package
treewide: pkgs.systemd -> config.systemd.package
2022-05-09 10:23:04 +02:00
Maximilian Bosch f0bb39d4b7
Merge pull request #167327 from lheckemann/networkd-usedhcp
nixos/networkd: reimplement useDHCP in a sensible way
2022-05-07 00:05:44 +02:00
Bernardo Meurer c4ad7519ef
Merge pull request #170136 from helsinki-systems/feat/systemd-stage-1-plymouth
nixos/plymouth: Add systemd stage 1 support
2022-05-05 14:49:26 -07:00
Sandro 836c52e625
Merge pull request #167208 from devplayer0/fix/missing-systemd-nspawn-options
nixos/systemd/nspawn: Add missing nspawn unit options
2022-05-05 22:58:59 +02:00
Janne Heß 57cd07f3a9
treewide: pkgs.systemd -> config.systemd.package
This ensures there is only one systemd package when e.g. testing the
next systemd version.
2022-05-05 20:00:31 +02:00
Rick van Schijndel ec4686ee14
Merge pull request #171247 from K900/systemd-boot-coreutils-mktemp
systemd-boot: use mktemp from coreutils in installer
2022-05-03 19:15:55 +02:00
Luflosi deed4a3d6c
nixos/stage-1: remove dead code
This special case for Btrfs was added in 51bc82960a. One year later beddd36c95 added code to skip the fsck entirely if the filesystem is Btrfs. This made the `if` statement unnecessary.
2022-05-03 16:15:51 +02:00
Janne Heß 2edce50847
Merge pull request #171134 from helsinki-systems/feat/make-initrd-ng-strip
makeInitrdNG: Strip more and remove output
2022-05-03 09:41:22 +02:00
K900 5a2f238b9a systemd-boot: use mktemp from coreutils in installer
People running nixos-install in non-NixOS environments
occasionally run into the mktemp builtin not being loaded
into bash (yes, even NixOS' bash). Rather than try and
figure out why exactly that is happening, just use a known
good mktemp from coreutils.
2022-05-02 15:44:55 +03:00
K900 5d02b86888 systemd-in-stage1: include firmware in initrd
duh.
2022-05-02 15:41:14 +03:00
Janne Heß bc53ac7753
nixos/systemd-shutdown: Remove unneeded binaries 2022-05-01 17:06:15 +02:00
Bernardo Meurer 78f6f77962
Merge pull request #169113 from ElvishJerricco/systemd-stage-1-installer-tests
nixos: Installer tests for systemd stage 1
2022-04-30 13:18:57 -07:00
Bernardo Meurer e1aa795705
Merge pull request #171024 from helsinki-systems/feat/systemd-stage-1-less-binaries
nixos/systemd-stage-1: Remove unnecessary binaries
2022-04-30 11:30:43 -07:00
Janne Heß 0411b51a00
nixos/systemd-stage-1: Remove unnecessary binaries
We can make the growfs and makefs binaries conditional because we know
if we'll need them. Also move the cryptsetup generator to the luksroot
so it's not included when not needed.

We drop some generators altogether: systemd-getty-generator because we
don't have getty anyway in stage 1, systemd-system-update-generator
because we don't use that logic in NixOS and
systemd-veritysetup-generator because stage 1 has no veritysetup support
(yet) and if it had, we still wouldn't want to include the generator
unconditionally.
2022-04-30 14:50:02 +02:00
Janne Heß fa2c9b41d4
nixos/systemd-stage-1: Add initrd secrets support 2022-04-30 11:41:27 +02:00
Maximilian Bosch 9c18662612
nixos/networkd: allow RouteMetric for IPv6AcceptRA
According to `systemd.network(5)` of systemd v249 this is a valid
option.

Fixes evaluation of the wildcard network definitions.
2022-04-30 00:30:04 +02:00
Will Fancher 2e96b64e02
Merge pull request #170123 from ElvishJerricco/systemd-shutdown-ramfs-fixup
Systemd shutdown ramfs fixup
2022-04-28 20:17:23 -04:00
Will Fancher 69d8047516 nixos: Fix up systemd shutdown ramfs 2022-04-28 14:12:14 -04:00
Bernardo Meurer 59aa6e4988
Merge pull request #170099 from helsinki-systems/feat/systemd-stage-1-no-random-seed
nixos/systemd-stage-1: Get rid of random-seed
2022-04-25 14:56:45 -07:00
Janne Heß 45494fab68
nixos/systemd-stage-1: Get rid of random-seed
This is not used at all since the unit has
ConditionPathExists=!/etc/initrd-release
2022-04-24 21:59:59 +01:00
Janne Heß acca3f4b81
nixos/plymouth: Add systemd stage 1 support 2022-04-24 21:47:49 +01:00
Janne Heß dc4b2812e4
nixos/stage-1-systemd: Also accept packages as store paths 2022-04-24 21:47:34 +01:00
Jack O'Sullivan 568cb2d6ab nixos/systemd/nspawn: Add missing nspawn unit options
A few options have been added to the `systemd.nspawn` unit type are
missing from `systemd.nspawn.*.*Config`. See systemd.nspawn(5).
2022-04-24 21:20:59 +01:00
Bernardo Meurer b23ec41f14
Merge pull request #168554 from helsinki-systems/feat/systemd-stage-1-luks
nixos/systemd-stage-1: Add basic LUKS support
2022-04-22 12:37:25 -07:00