Commit graph

2342 commits

Author SHA1 Message Date
Felix Bühler 0a2745684e
Merge pull request #239624 from Stunkymonkey/use-optionalString-then
treewide: use optionalString instead of 'then ""'
2023-07-22 13:02:47 +02:00
Matt Layher 93efcdac79
nixos/networkd: add DHCPServer PXE boot options
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2023-07-21 16:59:21 -04:00
Artturi dbef093f84
Merge pull request #244449 from Artturin/fixsrip1 2023-07-21 01:44:33 +03:00
Andrew Marshall 3d774b4453 util-linux: Fix build on non-Linux
Build logs show:

> configure: WARNING: non-linux system; not building mount
> configure: WARNING: non-linux system; not building swapon

So skip these on non-Linux

Using getOutput prevents eval failures on other platforms.
Things should stay eval'able with NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1

Co-authored-by: Artturin <Artturin@artturin.com>
2023-07-20 22:03:15 +03:00
Artturin 69267c22f1 nixos/stage-1: fix stripping
got broken in 6ea1a2a1be which changed
runCommandCC to runCommand but was not
noticed because it was failing silently

runCommand doesn't include CC or bintools
2023-07-20 21:26:38 +03:00
Will Fancher 22bcc32f63
Merge pull request #244033 from SuperSandro2000/issue-243820
nixos/stage-1: fix mount replacement in extra-utils
2023-07-20 00:43:33 -04:00
Will Fancher 2e60058b95
Revert "nixos/boot/stage-1: chase symlinks when copying binaries" 2023-07-20 00:03:50 -04:00
Florian Klink 8f15fe7914
Merge pull request #241370 from RaitoBezarius/vxlan-independent
nixos/networkd: support `Independent` flag for VXLAN netdevs
2023-07-19 23:18:54 +03:00
Florian Klink 6f66c57acc
Merge pull request #241365 from RaitoBezarius/macaddrs-netdevs
nixos/networkd: support netdev MAC addresses
2023-07-19 23:03:34 +03:00
Linus Heckemann dd2a892144 nixos/boot/stage-1: chase symlinks when copying binaries
The split of util-linux into further outputs (#236463) resulted in
${util-linux.bin}/bin/mount becoming a symlink. This broke zfs in some
cases.
2023-07-17 22:13:49 +02:00
Sandro Jäckel 222222bedb
nixos/stage-1: fix mount replacement in extra-utils 2023-07-17 21:12:39 +02:00
Linus Heckemann 7d2124f9e3 stage-1: Only copy mdadm and mdmon into initramfs if enabled 2023-07-10 20:31:13 +02:00
Linus Heckemann c0f963a338 boot.initrd.services.swraid -> boot.swraid
Since the option affects both stage-1 and stage-2, it does not make
sense to keep it within the boot.initrd namespace.
2023-07-10 20:20:08 +02:00
Lily Foster 5c1583bfd7
nixos/plymouth: fix minor doc rendering issue 2023-07-09 02:31:05 -04:00
K900 8533b23159 nixos/networkd: fix mismerge of #240969 and #241362 2023-07-09 07:34:42 +03:00
Will Fancher 0b25b4c7c9
Merge pull request #237908 from lilyinstarlight/upd/plymouth-2023-06-05
plymouth: unstable-2021-10-18 -> unstable-2023-06-05
2023-07-08 16:57:31 -04:00
Ryan Lahfa 186edce0a0
Merge pull request #241362 from RaitoBezarius/macvtap-networkd 2023-07-08 20:00:52 +02:00
Robert Hensing 3fd4ac8e82
Merge pull request #237040 from roberth/flexible-activation
nixos/system: Support pre-activated images
2023-07-08 16:06:25 +02:00
Raito Bezarius 6b9e49230d nixos/networkd: add MACVTAP= option for networks
Example 10. of man page of systemd.network(5) shows:
```

       Example 10. MacVTap

       This brings up a network interface "macvtap-test" and attaches it to "enp0s25".

           # /usr/lib/systemd/network/25-macvtap.network
           [Match]
           Name=enp0s25

           [Network]
           MACVTAP=macvtap-test
```

Which is a MACVTAP example and is currently unsupported in NixOS.
This is useful for people using "modern" technologies with virtual machines.
2023-07-08 15:42:10 +02:00
Ryan Lahfa 828633d36a
Merge pull request #241534 from samueldr/fix/finally-deprecate-boot-loader-raspberrypi 2023-07-08 14:16:27 +02:00
Samuel Dionne-Riel a6e61a1ea9 nixos: Formally deprecate boot.loader.raspberryPi
The whole option set was recommended against since mid-2019, and never
worked with the Raspberry Pi 4 family of devices.

We should have deprecated it in early 2020 for removal by 2021. At the
time I did not feel confident in making such a decision, and never
ended-up getting around to it.

The ***only*** supported-by-NixOS boot methods for AArch64 are
standards-based boot methods, namely UEFI or the pragmatically
almost-standard extlinux-compatible for U-Boot.

You can quote me on that.
2023-07-04 13:42:57 -04:00
Raito Bezarius faba775beb nixos/networkd: support Independent flag for VXLAN netdevs
According to networkd netdev's manpage:
```
       Independent=
           Takes a boolean. When true, the vxlan interface is created without any underlying network interface. Defaults to false, which means that a .network
           file that requests this VXLAN interface using VXLAN= is required for the VXLAN to be created.
```

is a valid option for [VXLAN] section.
2023-07-04 01:53:34 +02:00
Raito Bezarius 4d38fa043b nixos/networkd: support netdev MAC addresses
According to systemd.netdev manpage:

```
MACAddress=
           Specifies the MAC address to use for the device, or takes the special value "none". When "none", systemd-networkd does not request the MAC address for
           the device, and the kernel will assign a random MAC address. For "tun", "tap", or "l2tp" devices, the MACAddress= setting in the [NetDev] section is
           not supported and will be ignored. Please specify it in the [Link] section of the corresponding systemd.network(5) file. If this option is not set,
           "vlan" device inherits the MAC address of the master interface. For other kind of netdevs, if this option is not set, then the MAC address is
           generated based on the interface name and the machine-id(5).

           Note, even if "none" is specified, systemd-udevd will assign the persistent MAC address for the device, as 99-default.link has
           MACAddressPolicy=persistent. So, it is also necessary to create a custom .link file for the device, if the MAC address assignment is not desired.
```

Therefore, `none` is an acceptable value.
2023-07-04 01:21:35 +02:00
mutantmell d51ebb6173 nixos/networkd: refactor
Reduces size of networkd module by moving unit file generation code into a util.
2023-07-01 17:17:51 -07:00
pennae 969b4d7ba9
Merge pull request #232454 from quentinmit/bridge-vlan
nixos/networkd: Fix typo in BridgeVLAN options
2023-07-01 00:19:37 +02:00
Robert Hensing 772d6076e8 nixos: Add system.activatable flag for images that are pre-activated 2023-06-28 14:06:28 +02:00
Robert Hensing 9edad17d29 nixos/top-level: Remove unused builder variables
These variables were previously used by the activation script
build commands, but are now embedded into those commands for
to improve reusability for an upcoming addition.
2023-06-28 12:49:34 +02:00
Robert Hensing 7891c8cdaf nixos/activatable-system: Move legacy variables to top-level 2023-06-28 12:48:59 +02:00
Robert Hensing 990b72f6af nixos/activatable-system: Make system builder commands env independent
This way it will be easier to reuse in a different context, such as
a separate build of the activation script by itself (TBD).
2023-06-28 12:42:51 +02:00
Lily Foster 35337085ea
Merge pull request #237820 from lilyinstarlight/fix/systemd-initrd-network-default-package
nixos/networkd: make overriding boot.initrd.systemd.package a little easier by using mkDefault
2023-06-27 15:58:57 -04:00
Naïm Favier 0179d9f7e6
nixos/top-level: change extraDependencies from package to pathInStore
Allows adding subdirectory flake inputs that aren't top-level store paths.
2023-06-27 11:48:08 +02:00
iliana etaoin 53135cc8c7 nixos/grub: don't die on EFI-only systems if devices != ["nodev"]
Without this change, GRUB installation on non-PC systems (such as
aarch64-linux) only works if boot.loader.grub.devices is set to exactly
`["nodev"]`. If boot.loader.grub.devices was any other value (including
the default `[]`), users got the error:

    Died at /nix/store/an9ngv2vg95bdcy0ifsxlbkasprm4dcw-install-grub.pl line 586.

install-grub.pl verifies that if both $grub and $grubEfi are set, then
$grubTarget (e.g. i386-pc) and $grubTargetEfi (e.g. x86_64-efi) must
both be set, or the script will `die`. On non-PC systems, $grubTarget
is "".

When boot.loader.grub.devices is ["nodev"], $grub is set to null,
disabling non-EFI installation. But if a user has devices set for an
x86_64 config, or is using only mirroredBoots without setting devices,
they will hit this `die`.

This change sets $grub to "" if $grubTarget is "".
2023-06-25 17:46:12 +00:00
Felix Buehler 933a41a73f treewide: use optional instead of 'then []' 2023-06-25 09:11:40 -03:00
Felix Buehler f3719756b5 treewide: use optionalString instead of 'then ""' 2023-06-24 20:19:19 +02:00
Ryan Lahfa 230a3705fc
Merge pull request #234223 from alyssais/stage-1-bind-file 2023-06-22 21:47:30 +02:00
Sandro Jäckel 900104fc52
nixos/grub: remove grub 1 from descriptions 2023-06-20 22:34:25 +02:00
r-vdp c3fa4f9170
nixos/systemd: Make the fsck unit depend only on FS packages.
This means that this unit no longer need to be rebuilt when the system path is changed.
2023-06-18 12:46:13 +02:00
Lily Foster 7fb3975256
nixos/plymouth: add actual logo defaultText and move existing to example
Fixes #221391
2023-06-15 10:42:40 -04:00
Lily Foster ef0c0d5c2f
nixos/plymouth: use new runtime paths for plugins and themes 2023-06-15 10:42:37 -04:00
Lily Foster be48010eb2
nixos/networkd: make overriding boot.initrd.systemd.package a little easier by using mkDefault 2023-06-14 16:09:25 -04:00
Wout Mertens a97fe8990d
switch-to-configuration.pl: fix inverted dry-activate logic for swap 2023-06-14 12:11:45 +02:00
zi3m5f 67f5dcfd94 nixos/nspawn: fix spelling of systemd.nspawn MachineID option
This changes option systemd.nspawn.execConfig.MachineId to MachineID.
See man page systemd.nspawn(5)
2023-06-12 12:08:15 +02:00
Robert Hensing 193f4fea90 nixos/activatable-system: Make substitutions explicit
This helps with understanding the code.
We might make this not depend on environment variables later.
systemBuilderArgs is a form of global state, which isn't helpful.
2023-06-10 19:15:00 +02:00
Robert Hensing a16986f1a3 nixos: Move installBootLoader to activation script modules 2023-06-10 19:15:00 +02:00
Robert Hensing 61d43dee5f nixos: Extract module for activation script inclusion into toplevel
Allows omission of this functionality through disabledModules, e.g.
for image building.
2023-06-10 19:15:00 +02:00
Will Fancher 90d69b1634
Merge pull request #236388 from ElvishJerricco/sd-s1-networkd-stop-on-switch-root
systemd stage 1 networking: Stop systemd-networkd on switch-root
2023-06-10 00:35:56 -04:00
Will Fancher 5d6ea734a1 systemd stage 1 networking: Stop systemd-networkd on switch-root
This essentially backports
https://github.com/systemd/systemd/pull/27791. `systemd-networkd.service`
is sent the `SIGTERM` signal, but it is not required to be stopped
before `initrd-switch-root.target` is reached, despite the use of
`systemctl isolate initrd-switch-root.target`. This is because when
there is no ordering at all between two units, and a transaction stops
one and starts the other, the two operations can happen
simultaneously. This means the service could still be running when
`switch-root` actually occurs. Then, stage 2 systemd will see the
service still running and decide it doesn't need to add a start
operation for it to its initial transaction. Finally, the service
exits, but only after it's already too late. If, however, there is any
ordering at all between a stopping unit and a starting unit, then the
stop operation will be done first. This way, we ensure that the
service is properly exited before doing `switch-root`.

This is something to keep in mind going forward. There may be other
services that need this treatment. These `before` and `conflicts`
definitions are the correct way to ensure a unit is actually stopped
before you reach initrd-switch-root
2023-06-08 00:25:15 -04:00
Victor Engmark 8deaa732a8 refactor: Split mkdir -m … into mkdir + chmod
As recommended by ShellCheck
<https://www.shellcheck.net/wiki/SC2174>.
2023-06-08 15:55:40 +12:00
Sandro Jäckel fadc824f20
nixos/etc: keep directories in derivation name
This changes eg. etc-timesyncd.conf to etc-systemd-timesyncd.conf which
better reflects the actual location of the config file.
2023-06-07 00:08:43 +02:00
Will Fancher b497502357 nixos: Use systemd-growfs for autoResize 2023-06-04 22:57:22 -04:00
Will Fancher 5176a4f113 nixos: Use systemd-makefs for autoFormat 2023-06-04 22:57:20 -04:00
Will Fancher 76d668fae7
Merge pull request #227628 from m-bdf/logind-handle-keys
nixos/logind: Add key handling options
2023-05-29 14:31:43 -04:00
Graham Christensen 479712af11
networkd: support specifying the ClientIdentifier for DHCPv4 options 2023-05-27 15:06:06 +02:00
Alyssa Ross a92bc576b1
nixos/stage-1: support bind mounts of files
On my system, / is tmpfs, and /etc/machine-id is bind mounted from
/persist.
2023-05-26 13:26:48 +00:00
Will Fancher fe43923a70
Merge pull request #229767 from mberndt123/mberndt123/stratis-rootfs
nixos/stratis: initrd support for stratis root volumes
2023-05-25 14:06:31 -04:00
Will Fancher 636e03bef3
Merge pull request #232533 from nikstur/systemd-repart-create-root
nixos/systemd-repart: enable creating root partition
2023-05-22 09:13:00 -04:00
figsoda 701bcdbead nixos: fix typos 2023-05-19 22:31:04 -04:00
Bjørn Forsman ef85c3fe51 nixos: use passAsFile to avoid "Argument list too long" error
This patch fixes "Argument list too long" build failure when passing a
list of store paths to system.extraDependencies that exceeds Linux'
MAX_ARG_STRLEN limit of 128 KiB. With the shortest possible derivation
names (one byte), the 128 KiB limit is equivalent to about 2850
derivations. With longer derivations names, the limit is hit earlier.
Fix this restriction.
2023-05-19 22:31:31 +02:00
Matthias Berndt 765349d345 minor refactoring 2023-05-19 10:22:45 -04:00
nikstur ef80e11032 nixos/systemd-repart: enable creating root partition 2023-05-19 15:54:55 +02:00
Matthias Berndt cb410a8c59 Merge remote-tracking branch 'upstream/master' into mberndt123/stratis-rootfs 2023-05-17 21:47:19 -04:00
Matthias Berndt 92814241a8 improve stratis initrd support
it is now possible to supply a stratis pool uuid
for every filesystem, and if that filesystem
is required for boot, the relevant pool will be
started in the initramfs.
2023-05-16 22:48:36 -04:00
Quentin Smith ad7b199d5d
nixos/networkd: Fix typo in BridgeVLAN options 2023-05-16 19:33:34 -04:00
Robert Hensing 25f227fc67
Merge pull request #231316 from hercules-ci/nixos-system.checks
NixOS: add `system.checks`
2023-05-15 23:16:29 +02:00
Ryan Lahfa 1ee11b8a31
Merge pull request #231283 from nikstur/filesystems-erofs
nixos/filesystems: init erofs
2023-05-14 18:54:37 +02:00
Florian Klink e9c6179ad0
Merge pull request #231504 from nikstur/systemd-repart-add-maintainer
nixos/systemd-repart: add myself as maintainer
2023-05-13 10:51:11 +03:00
nikstur fa09e0a3c7 nixos/filesystems: init erofs
Enable using an erofs filesystem as one of the filesystems needed to
boot the system. This is useful for example in image based deployments
where the Nix store is mounted read only.
[erofs](https://docs.kernel.org/filesystems/erofs.html) offers multiple
benefits over older filesystems like squashfs. Skip fsck.erofs because
it is still experimental.
2023-05-12 19:55:32 +02:00
nikstur 1bd62f43eb nixos/systemd-repart: add myself as maintainer 2023-05-12 18:55:09 +02:00
Robert Hensing 5bdf63819b nixos/top-level.nix: Add system.checks
Note that this does not add to the `forbiddenDependenciesRegex`
code because that code check should be unaffected as it only checks
output dependencies, not build dependencies.
Build deps are added after that check, if those are enabled in the
first place.
2023-05-11 21:18:38 +02:00
ajs124 96fbdcedcd trustedGrub: remove 2023-05-10 22:17:56 +02:00
ajs124 1319323458 nixos/grub: turn definition of version option from an error into a warning
because a lot of configurations (generated by nixos-generate-config) contain it
2023-05-10 21:51:26 +02:00
ajs124 30bea8d82d nixos/*: remove boot.grub.version 2023-05-10 21:51:26 +02:00
Lin Yinfeng 1e05869917
nixos/networkd: fix typo of tokenBucketFilterConfig 2023-05-09 23:06:47 +08:00
nikstur d85abd2764 nixos/systemd-repart: definition files in initrd
Store the definition files in the initrd instead of reading them from
the Nix store in /sysroot.

This way, the initrd has to be re-generated every time the definition
files change. When the path to the defintion files instead of the
definition files themselves are embedded in the initrd, however, the
initrd also has to be re-generated every time. In this regard, this
change does not improve the status quo.

However, now systemd-repart also works reliable when the Nix store is
mounted separately from the root partition.

This change also enables new use-cases like creating partitions
necessary to boot the system. However, by default, the root partition
cannot be created on first boot because the systemd-repart service
requires a /sysroot to be mounted. Otherwise, systemd-repart cannot
determine the device to operate on.
2023-05-09 00:11:21 +02:00
Matthias Berndt 8aa320b4c2 address code review issues 2023-05-08 23:18:55 +02:00
nikstur 5c2a7490cf nixos/systemd-repart: fix
Since v253, systemd-repart tries to create temporary directories in
/var/tmp. However, this directory doesn't exist in the initrd. This
commit adds an enviroment variable to re-use the existing /tmp directory
instead of /var/tmp.
2023-05-08 23:12:59 +02:00
Matthias Berndt 9f1bc0fa02 address review comments 2023-05-07 18:48:28 +02:00
Matthias Berndt 1632e73b19 nixos/stratis: enable booting from stratis volume 2023-05-07 18:48:28 +02:00
Bernardo Meurer aa8eff129d
nixos/networkd: add TransmitQueues and TransmitQueueLength
These are relevant when using networkd to configure CAN networks

Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com>
2023-05-06 21:55:09 -04:00
Ryan Lahfa 0b0c5fdf95
Merge pull request #230027 from jmbaur/fix-cross-nixos-system
nixos/bootspec: Fix cross for nixos-system systemBuilder
2023-05-05 22:05:44 +02:00
Ryan Lahfa 275a6e3d8d
Merge pull request #193469 from minijackson/mount-options-stage-1
nixos/stage-1: follow mount options
2023-05-05 17:05:48 +02:00
Jared Baur 67561dcc59
nixos/bootspec: Fix cross for nixos-system systemBuilder
When `nixpkgs.hostPlatform` != `nixpkgs.buildPlatform`, building the
top-level attribute fails since the bootspec portion of the system
builder tries to reference the host platform's `jq`. Change this to
reference the build platform's `jq`.
2023-05-04 20:09:16 -07:00
Rene Hollander a70c7aba36 nixos/networkd: Fix typo in usage sectionBridgeVLAN
The `B` in bridge should be capitalized.

It currently leads to an evuluation error: 
```
error: attribute 'sectionbridgeVLAN' missing

       at /nix/store/7wmrwj0sgwg1iivxk43lpkqjhji57mq7-source/nixos/modules/system/boot/networkd.nix:2386:56:

         2385|       example = { VLAN = "10-20"; };
         2386|       type = types.addCheck (types.attrsOf unitOption) check.network.sectionbridgeVLAN;
             |                                                        ^
         2387|       description = lib.mdDoc ''
       Did you mean sectionBridgeVLAN?
```
2023-05-04 16:20:56 +02:00
Jörg Thalheim be8e3128b9
Merge pull request #223418 from Mic92/grub
nixos/grub-install: don't rely on shell to run commands
2023-05-04 09:48:41 +01:00
Raito Bezarius bc502d0a14 nixos/bootspec: adopt the merged RFC-0125
This removes the feature preview warning, enable by default bootspec,
adds a validation flag to prevent Go to go into build-time closure.

This will break all downstream users of bootspec as those changes are
not backward-compatible.
2023-04-28 18:26:11 -07:00
Weijia Wang b2ef7956b6
Merge pull request #227560 from jackyliu16/loongnix-commit
lib.platforms.loongarch64: init
2023-04-28 13:21:42 +03:00
jackyliu16 15e3a50bd3 nixos/binfmt: add loongarch64-linux 2023-04-28 12:11:58 +03:00
Minijackson b25259e021
nixos/stage-1: follow mount options
For fileSystems needed for boot which are bind mounts, busybox tend to
ignore mount options, so we remount right afterwards
2023-04-25 12:47:39 +02:00
Maëlys Bras de fer 520150fa89
nixos/logind: Add key handling options 2023-04-22 14:41:36 +00:00
Will Fancher e56084d2a0 systemd-stage-1: Revert assertions about initrd commands 2023-04-22 10:25:16 -04:00
Will Fancher 1598338521 systemd-stage-1: Make networkd options shallow 2023-04-21 21:52:38 -04:00
Will Fancher 5c46e6f4e3 systemd-stage-1: Add assertions for unsupported options. 2023-04-21 13:05:12 -04:00
Will Fancher 8f9416e9e3 systemd-stage-1: Unhide documentation 2023-04-21 13:04:15 -04:00
Florian Klink 6b27ed3229
Merge pull request #169116 from ElvishJerricco/systemd-stage-1-networkd
Systemd stage 1 networkd
2023-04-21 18:40:59 +02:00
Artturi b83db86a9e
Merge pull request #222080 from Stunkymonkey/nixos-optionalString 2023-04-20 16:07:30 +03:00
Will Fancher 3cb9534df6 systemd-initrd: Flush networkd 2023-04-17 16:41:36 -04:00
Will Fancher 8598234651 systemd-initrd: dbus 2023-04-17 16:41:36 -04:00
Will Fancher 834ec135ce systemd-initrd: OpenVPN 2023-04-17 16:41:35 -04:00
Will Fancher 0698a1cf04 systemd-initrd: sshd 2023-04-17 16:41:35 -04:00
Will Fancher dd392d7c76 systemd-initrd: networkd 2023-04-17 16:41:34 -04:00