feat: add support for grub bootloader

We require this for setting up a VPS on Hetzner Cloud, since Hetzner uses
legacy BIOS boot for its instances.

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2024-10-08 19:53:02 +05:30
parent 9805ff5d94
commit bc05090f5b
Signed by: thunderbottom
GPG Key ID: 75507BE256F40CED

View File

@ -20,6 +20,10 @@
description = "Timezone to use for the system"; description = "Timezone to use for the system";
default = "Asia/Kolkata"; default = "Asia/Kolkata";
}; };
bootloader = lib.mkOption {
type = lib.types.enum ["systemd-boot" "grub"];
description = "Bootloader to use, can be either `systemd-boot` or `grub`";
};
}; };
config = { config = {
@ -38,7 +42,7 @@
snowflake.core.sshd.enable = lib.mkDefault true; snowflake.core.sshd.enable = lib.mkDefault true;
boot = { boot = {
initrd.systemd.enable = true; initrd.systemd.enable = config.snowflake.bootloader == "systemd-boot";
initrd.verbose = false; initrd.verbose = false;
# Default to the latest kernel package. # Default to the latest kernel package.
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
@ -50,10 +54,17 @@
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
# Use systemd-boot for all systems. # Use systemd-boot for all systems.
systemd-boot = { systemd-boot = {
enable = true; enable = config.snowflake.bootloader == "systemd-boot";
# Show only last 5 configurations in the boot menu. # Show only last 5 configurations in the boot menu.
configurationLimit = lib.mkDefault 5; configurationLimit = lib.mkDefault 5;
}; };
grub = {
enable = config.snowflake.bootloader == "grub";
efiSupport = true;
efiInstallAsRemovable = true;
forceInstall = true;
};
}; };
}; };