[Boot] Remove EFI boot auto-detection, demand explicit configuration instead

This commit is contained in:
Antoine Viallon 2023-04-04 16:05:43 +02:00
parent 6bd20a7600
commit 33060cff17
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -105,10 +105,16 @@ in {
efi = mkOption rec { efi = mkOption rec {
description = "Use EFI bootloader"; description = "Use EFI bootloader";
default = builtins.pathExists "/sys/firmware/efi"; example = true;
example = !default; type = with types; bool;
type = types.bool;
}; };
legacy = mkOption rec {
description = "Use legacy bootloader";
default = !cfg.efi;
example = true;
type = with types; bool;
};
configurationLimit = mkOption { configurationLimit = mkOption {
description = "Maximum number of generations in the boot menu"; description = "Maximum number of generations in the boot menu";
default = 30; default = 30;
@ -138,10 +144,17 @@ in {
}; };
}; };
config = { config = mkMerge [
boot.kernelParams = toCmdlineList cfg.cmdline; {
} // (mkIf cfg.enable { assertions = [
{ assertion = cfg.efi -> !cfg.legacy;
message = "exactly one of aviallon.boot.efi and aviallon.boot.legacy must be set";
}
];
boot.kernelParams = toCmdlineList cfg.cmdline; boot.kernelParams = toCmdlineList cfg.cmdline;
}
(mkIf cfg.enable {
hardware.enableAllFirmware = allowUnfree; hardware.enableAllFirmware = allowUnfree;
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
@ -196,5 +209,6 @@ in {
efi.canTouchEfiVariables = mkDefault true; efi.canTouchEfiVariables = mkDefault true;
}; };
}; };
}); })
];
} }