mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
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>
This commit is contained in:
parent
95355b4d94
commit
c156a809e3
4 changed files with 53 additions and 12 deletions
|
@ -731,19 +731,28 @@ let
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${lib.optionalString installBootLoader ''
|
${lib.optionalString installBootLoader ''
|
||||||
# In this throwaway resource, we only have /dev/vda, but the actual VM may refer to another disk for bootloader, e.g. /dev/vdb
|
# In this throwaway resource, we only have /dev/vda, but the actual VM may refer to another disk for bootloader, e.g. /dev/vdb
|
||||||
# Use this option to create a symlink from vda to any arbitrary device you want.
|
# Use this option to create a symlink from vda to any arbitrary device you want.
|
||||||
${lib.optionalString (config.boot.loader.grub.enable) (
|
${lib.optionalString (config.boot.loader.grub.enable) (
|
||||||
lib.concatMapStringsSep " " (
|
lib.concatMapStringsSep " " (
|
||||||
device:
|
device:
|
||||||
lib.optionalString (device != "/dev/vda") ''
|
lib.optionalString (device != "/dev/vda") ''
|
||||||
mkdir -p "$(dirname ${device})"
|
mkdir -p "$(dirname ${device})"
|
||||||
ln -s /dev/vda ${device}
|
ln -s /dev/vda ${device}
|
||||||
''
|
''
|
||||||
) config.boot.loader.grub.devices
|
) config.boot.loader.grub.devices
|
||||||
)}
|
)}
|
||||||
|
${
|
||||||
|
let
|
||||||
|
limine = config.boot.loader.limine;
|
||||||
|
in
|
||||||
|
lib.optionalString (limine.enable && limine.biosSupport && limine.biosDevice != "/dev/vda") ''
|
||||||
|
mkdir -p "$(dirname ${limine.biosDevice})"
|
||||||
|
ln -s /dev/vda ${limine.biosDevice}
|
||||||
|
''
|
||||||
|
}
|
||||||
|
|
||||||
# Set up core system link, bootloader (sd-boot, GRUB, uboot, etc.), etc.
|
# Set up core system link, bootloader (sd-boot, GRUB, uboot, etc.), etc.
|
||||||
|
|
||||||
# NOTE: systemd-boot-builder.py calls nix-env --list-generations which
|
# NOTE: systemd-boot-builder.py calls nix-env --list-generations which
|
||||||
# clobbers $HOME/.nix-defexpr/channels/nixos This would cause a folder
|
# clobbers $HOME/.nix-defexpr/channels/nixos This would cause a folder
|
||||||
|
|
|
@ -1159,6 +1159,9 @@ in
|
||||||
`useBootLoader` useless. You might want to disable one of those options.
|
`useBootLoader` useless. You might want to disable one of those options.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Install Limine on the bootloader device
|
||||||
|
boot.loader.limine.biosDevice = cfg.bootLoaderDevice;
|
||||||
|
|
||||||
# In UEFI boot, we use a EFI-only partition table layout, thus GRUB will fail when trying to install
|
# In UEFI boot, we use a EFI-only partition table layout, thus GRUB will fail when trying to install
|
||||||
# legacy and UEFI. In order to avoid this, we have to put "nodev" to force UEFI-only installs.
|
# legacy and UEFI. In order to avoid this, we have to put "nodev" to force UEFI-only installs.
|
||||||
# Otherwise, we set the proper bootloader device for this.
|
# Otherwise, we set the proper bootloader device for this.
|
||||||
|
|
28
nixos/tests/limine/bios.nix
Normal file
28
nixos/tests/limine/bios.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
name = "bios";
|
||||||
|
meta.maintainers = with lib.maintainers; [
|
||||||
|
lzcunt
|
||||||
|
phip1611
|
||||||
|
programmerlexi
|
||||||
|
];
|
||||||
|
meta.platforms = [
|
||||||
|
"i686-linux"
|
||||||
|
"x86_64-linux"
|
||||||
|
];
|
||||||
|
nodes.machine =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
virtualisation.useBootLoader = true;
|
||||||
|
virtualisation.useBootPartition = true;
|
||||||
|
boot.loader.limine.enable = true;
|
||||||
|
boot.loader.limine.efiSupport = false;
|
||||||
|
boot.loader.timeout = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.start()
|
||||||
|
with subtest('Machine boots correctly'):
|
||||||
|
machine.wait_for_unit('multi-user.target')
|
||||||
|
'';
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
bios = runTest ./bios.nix;
|
||||||
checksum = runTest ./checksum.nix;
|
checksum = runTest ./checksum.nix;
|
||||||
secureBoot = runTest ./secure-boot.nix;
|
secureBoot = runTest ./secure-boot.nix;
|
||||||
specialisations = runTest ./specialisations.nix;
|
specialisations = runTest ./specialisations.nix;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue