nixos/installer/grub1: remove

This commit is contained in:
ajs124 2022-04-04 17:22:03 +01:00
parent a8d9014274
commit 6db7450827
2 changed files with 11 additions and 40 deletions

View File

@ -10,7 +10,7 @@ with pkgs.lib;
let
# The configuration to install.
makeConfig = { bootLoader, grubVersion, grubDevice, grubIdentifier, grubUseEfi
makeConfig = { bootLoader, grubDevice, grubIdentifier, grubUseEfi
, extraConfig, forceGrubReinstallCount ? 0
}:
pkgs.writeText "configuration.nix" ''
@ -29,11 +29,6 @@ let
${optionalString systemdStage1 "boot.initrd.systemd.enable = true;"}
${optionalString (bootLoader == "grub") ''
boot.loader.grub.version = ${toString grubVersion};
${optionalString (grubVersion == 1) ''
boot.loader.grub.splashImage = null;
''}
boot.loader.grub.extraConfig = "serial; terminal_output serial";
${if grubUseEfi then ''
boot.loader.grub.device = "nodev";
@ -70,11 +65,11 @@ let
# disk, and then reboot from the hard disk. It's parameterized with
# a test script fragment `createPartitions', which must create
# partitions and filesystems.
testScriptFun = { bootLoader, createPartitions, grubVersion, grubDevice, grubUseEfi
testScriptFun = { bootLoader, createPartitions, grubDevice, grubUseEfi
, grubIdentifier, preBootCommands, postBootCommands, extraConfig
, testSpecialisationConfig
}:
let iface = if grubVersion == 1 then "ide" else "virtio";
let iface = "virtio";
isEfi = bootLoader == "systemd-boot" || (bootLoader == "grub" && grubUseEfi);
bios = if pkgs.stdenv.isAarch64 then "QEMU_EFI.fd" else "OVMF.fd";
in if !isEfi && !pkgs.stdenv.hostPlatform.isx86 then ''
@ -122,7 +117,7 @@ let
machine.succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2")
machine.copy_from_host(
"${ makeConfig {
inherit bootLoader grubVersion grubDevice grubIdentifier
inherit bootLoader grubDevice grubIdentifier
grubUseEfi extraConfig;
}
}",
@ -193,7 +188,7 @@ let
# doesn't know about the host-guest sharing mechanism.
machine.copy_from_host_via_shell(
"${ makeConfig {
inherit bootLoader grubVersion grubDevice grubIdentifier
inherit bootLoader grubDevice grubIdentifier
grubUseEfi extraConfig;
forceGrubReinstallCount = 1;
}
@ -222,7 +217,7 @@ let
# doesn't know about the host-guest sharing mechanism.
machine.copy_from_host_via_shell(
"${ makeConfig {
inherit bootLoader grubVersion grubDevice grubIdentifier
inherit bootLoader grubDevice grubIdentifier
grubUseEfi extraConfig;
forceGrubReinstallCount = 2;
}
@ -284,7 +279,7 @@ let
{ createPartitions, preBootCommands ? "", postBootCommands ? "", extraConfig ? ""
, extraInstallerConfig ? {}
, bootLoader ? "grub" # either "grub" or "systemd-boot"
, grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid", grubUseEfi ? false
, grubDevice ? "/dev/vda", grubIdentifier ? "uuid", grubUseEfi ? false
, enableOCR ? false, meta ? {}
, testSpecialisationConfig ? false
}:
@ -316,11 +311,9 @@ let
# installer. This ensures the target disk (/dev/vda) is
# the same during and after installation.
virtualisation.emptyDiskImages = [ 512 ];
virtualisation.rootDevice =
if grubVersion == 1 then "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive2" else "/dev/vdb";
virtualisation.rootDevice = "/dev/vdb";
virtualisation.bootLoaderDevice = "/dev/vda";
virtualisation.qemu.diskInterface =
if grubVersion == 1 then "scsi" else "virtio";
virtualisation.qemu.diskInterface = "virtio";
# We don't want to have any networking in the guest whatsoever.
# Also, if any vlans are enabled, the guest will reboot
@ -372,8 +365,7 @@ let
# curl's tarball, we see what it's trying to download
curl
]
++ optional (bootLoader == "grub" && grubVersion == 1) pkgs.grub
++ optionals (bootLoader == "grub" && grubVersion == 2) (let
++ optionals (bootLoader == "grub") (let
zfsSupport = lib.any (x: x == "zfs")
(extraInstallerConfig.boot.supportedFilesystems or []);
in [
@ -392,7 +384,7 @@ let
testScript = testScriptFun {
inherit bootLoader createPartitions preBootCommands postBootCommands
grubVersion grubDevice grubIdentifier grubUseEfi extraConfig
grubDevice grubIdentifier grubUseEfi extraConfig
testSpecialisationConfig;
};
};
@ -875,26 +867,6 @@ in {
'';
};
# Test a basic install using GRUB 1.
grub1 = makeInstallerTest "grub1" rec {
createPartitions = ''
machine.succeed(
"flock ${grubDevice} parted --script ${grubDevice} -- mklabel msdos"
+ " mkpart primary linux-swap 1M 1024M"
+ " mkpart primary ext2 1024M -1s",
"udevadm settle",
"mkswap ${grubDevice}-part1 -L swap",
"swapon -L swap",
"mkfs.ext3 -L nixos ${grubDevice}-part2",
"mount LABEL=nixos /mnt",
"mkdir -p /mnt/tmp",
)
'';
grubVersion = 1;
# /dev/sda is not stable, even when the SCSI disk number is.
grubDevice = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive1";
};
# Test using labels to identify volumes in grub
simpleLabels = makeInstallerTest "simpleLabels" {
createPartitions = ''

View File

@ -426,7 +426,6 @@ stdenv.mkDerivation rec {
passthru.tests = {
nixos-grub = nixosTests.grub;
nixos-install-simple = nixosTests.installer.simple;
nixos-install-grub1 = nixosTests.installer.grub1;
nixos-install-grub-uefi = nixosTests.installer.simpleUefiGrub;
nixos-install-grub-uefi-spec = nixosTests.installer.simpleUefiGrubSpecialisation;
};