2021-03-14 10:58:29 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.magic_rb.grub;
|
|
|
|
in
|
2020-12-26 23:36:50 +01:00
|
|
|
{
|
2021-03-14 10:58:29 +01:00
|
|
|
options.magic_rb.grub = with lib; {
|
|
|
|
enable = mkEnableOption "GRUB preconfigured for my setup style";
|
|
|
|
efi = mkOption {
|
|
|
|
type = types.submodule {
|
|
|
|
options.enable = mkEnableOption "EFI support";
|
|
|
|
};
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
|
|
|
|
devices = mkOption {
|
|
|
|
description = "GRUB devices for legacy";
|
|
|
|
default = [];
|
|
|
|
type = types.list;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
boot.loader = mkIf cfg.enable {
|
|
|
|
systemd-boot.enable = false;
|
|
|
|
efi.canTouchEfiVariables = cfg.efi.enable;
|
|
|
|
efi.efiSysMountPoint = "/boot/EFI";
|
2020-12-26 23:36:50 +01:00
|
|
|
|
2021-03-14 10:58:29 +01:00
|
|
|
grub = {
|
|
|
|
enable = true;
|
|
|
|
efiSupport = cfg.efi.enable;
|
|
|
|
version = 2;
|
|
|
|
devices = if cfg.efi.enable then [ "nodev" ] else cfg.devices;
|
|
|
|
};
|
2020-12-26 23:36:50 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|