mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Boot] Remove EFI boot auto-detection, demand explicit configuration instead
This commit is contained in:
parent
6bd20a7600
commit
33060cff17
1 changed files with 22 additions and 8 deletions
28
boot.nix
28
boot.nix
|
|
@ -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;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue