nixpkgs/nixos/lib
nikstur 0bdba6c99b nixos/qemu-vm: use persistent block device names
This change removes the bespoke logic around identifying block devices.
Instead of trying to find the right device by iterating over
`qemu.drives` and guessing the right partition number (e.g.
/dev/vda{1,2}), devices are now identified by persistent names provided
by udev in /dev/disk/by-*.

Before this change, the root device was formatted on demand in the
initrd. However, this makes it impossible to use filesystem identifiers
to identify devices. Now, the formatting step is performed before the VM
is started. Because some tests, however, rely on this behaviour, a
utility function to replace this behaviour in added in
/nixos/tests/common/auto-format-root-device.nix.

Devices that contain neither a partition table nor a filesystem are
identified by their hardware serial number which is injecetd via QEMU
(and is thus persistent and predictable). PCI paths are not a reliably
way to identify devices because their availability and numbering depends
on the QEMU machine type.

This change makes the module more robust against changes in QEMU and the
kernel (non-persistent device naming) and by decoupling abstractions
(i.e. rootDevice, bootPartition, and bootLoaderDevice) enables further
improvement down the line.
2023-06-16 19:36:03 +02:00
..
make-options-doc nixos-render-docs: add options asciidoc converter 2023-02-21 18:19:00 +01:00
test-driver nixos/test-driver: fix formatting 2023-05-28 12:29:26 +00:00
testing nixos/qemu-vm: quoted string reformat 2023-05-24 08:54:22 +10:00
default.nix nixos/testing: Move entrypoint to nixos/lib + doc 2022-09-24 17:38:08 +01:00
eval-cacheable-options.nix nixos,nixpkgs: Add module classes 2023-05-06 18:29:04 +02:00
eval-config-minimal.nix lib/modules: Move class out of specialArgs 2023-05-06 18:32:58 +02:00
eval-config.nix nixos/eval-config: Remove statically known mkIf 2023-05-10 15:55:09 +02:00
from-env.nix
make-channel.nix channel: add --show-trace to nix-env command 2023-02-03 23:02:47 +00:00
make-disk-image.nix nixos/qemu-vm: use persistent block device names 2023-06-16 19:36:03 +02:00
make-ext4-fs.nix honor sdImage.compressImage in intermediate build steps 2021-12-21 21:31:44 +01:00
make-iso9660-image.nix make-iso9660-image: use __structuredAttrs 2023-05-11 14:25:44 +02:00
make-iso9660-image.sh make-iso9660-image: use __structuredAttrs 2023-05-11 14:25:44 +02:00
make-multi-disk-zfs-image.nix nixos/lib/make-(multi|single)-disk-zfs-image: use qemu_kvm (host arch) instead of qemu (all arches) 2023-04-28 23:50:44 +02:00
make-single-disk-zfs-image.nix nixos/lib/make-(multi|single)-disk-zfs-image: use qemu_kvm (host arch) instead of qemu (all arches) 2023-04-28 23:50:44 +02:00
make-squashfs.nix make-squashfs: use __structuredAttrs 2023-05-11 14:25:31 +02:00
make-system-tarball.nix make-system-tarball: use pixz -t 2022-08-22 05:28:36 +03:00
make-system-tarball.sh
qemu-common.nix nixos/lib/qemu-common.nix: set qemuSerialDevice for isMips64 2022-10-04 07:48:12 +00:00
systemd-lib.nix nixos/lib: save triggers of systemd into nix store 2023-05-11 17:38:54 +08:00
systemd-types.nix nixos/*: automatically convert option descriptions 2022-08-31 16:32:53 +02:00
systemd-unit-options.nix systemd.units.<name>.wantedBy: fix documentation rendering 2023-05-18 18:04:31 +02:00
test-script-prepend.py nixos/test-driver: Typecheck TestScript 2022-06-02 10:05:45 +02:00
testing-python.nix nixos/testing-python.nix: Help users who need specialArgs 2022-12-23 18:41:52 +01:00
utils.nix lib.replaceChars: warn about being a deprecated alias 2022-12-15 22:25:51 +02:00