nixosTests.limine.bios: init

This patch adds a NixOS test for Limine on BIOS systems. It also fixes
some formatting in `nixos/lib/make-disk-image.nix`.

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>

authored by

sanana and committed by
Masum Reza
c156a809 95355b4d

+53 -12
+21 -12
nixos/lib/make-disk-image.nix
··· 731 731 ''} 732 732 733 733 ${lib.optionalString installBootLoader '' 734 - # In this throwaway resource, we only have /dev/vda, but the actual VM may refer to another disk for bootloader, e.g. /dev/vdb 735 - # Use this option to create a symlink from vda to any arbitrary device you want. 736 - ${lib.optionalString (config.boot.loader.grub.enable) ( 737 - lib.concatMapStringsSep " " ( 738 - device: 739 - lib.optionalString (device != "/dev/vda") '' 740 - mkdir -p "$(dirname ${device})" 741 - ln -s /dev/vda ${device} 742 - '' 743 - ) config.boot.loader.grub.devices 744 - )} 734 + # In this throwaway resource, we only have /dev/vda, but the actual VM may refer to another disk for bootloader, e.g. /dev/vdb 735 + # Use this option to create a symlink from vda to any arbitrary device you want. 736 + ${lib.optionalString (config.boot.loader.grub.enable) ( 737 + lib.concatMapStringsSep " " ( 738 + device: 739 + lib.optionalString (device != "/dev/vda") '' 740 + mkdir -p "$(dirname ${device})" 741 + ln -s /dev/vda ${device} 742 + '' 743 + ) config.boot.loader.grub.devices 744 + )} 745 + ${ 746 + let 747 + limine = config.boot.loader.limine; 748 + in 749 + lib.optionalString (limine.enable && limine.biosSupport && limine.biosDevice != "/dev/vda") '' 750 + mkdir -p "$(dirname ${limine.biosDevice})" 751 + ln -s /dev/vda ${limine.biosDevice} 752 + '' 753 + } 745 754 746 - # Set up core system link, bootloader (sd-boot, GRUB, uboot, etc.), etc. 755 + # Set up core system link, bootloader (sd-boot, GRUB, uboot, etc.), etc. 747 756 748 757 # NOTE: systemd-boot-builder.py calls nix-env --list-generations which 749 758 # clobbers $HOME/.nix-defexpr/channels/nixos This would cause a folder
+3
nixos/modules/virtualisation/qemu-vm.nix
··· 1159 1159 `useBootLoader` useless. You might want to disable one of those options. 1160 1160 ''; 1161 1161 1162 + # Install Limine on the bootloader device 1163 + boot.loader.limine.biosDevice = cfg.bootLoaderDevice; 1164 + 1162 1165 # In UEFI boot, we use a EFI-only partition table layout, thus GRUB will fail when trying to install 1163 1166 # legacy and UEFI. In order to avoid this, we have to put "nodev" to force UEFI-only installs. 1164 1167 # Otherwise, we set the proper bootloader device for this.
+28
nixos/tests/limine/bios.nix
··· 1 + { lib, ... }: 2 + { 3 + name = "bios"; 4 + meta.maintainers = with lib.maintainers; [ 5 + lzcunt 6 + phip1611 7 + programmerlexi 8 + ]; 9 + meta.platforms = [ 10 + "i686-linux" 11 + "x86_64-linux" 12 + ]; 13 + nodes.machine = 14 + { ... }: 15 + { 16 + virtualisation.useBootLoader = true; 17 + virtualisation.useBootPartition = true; 18 + boot.loader.limine.enable = true; 19 + boot.loader.limine.efiSupport = false; 20 + boot.loader.timeout = 0; 21 + }; 22 + 23 + testScript = '' 24 + machine.start() 25 + with subtest('Machine boots correctly'): 26 + machine.wait_for_unit('multi-user.target') 27 + ''; 28 + }
+1
nixos/tests/limine/default.nix
··· 3 3 ... 4 4 }: 5 5 { 6 + bios = runTest ./bios.nix; 6 7 checksum = runTest ./checksum.nix; 7 8 secureBoot = runTest ./secure-boot.nix; 8 9 specialisations = runTest ./specialisations.nix;