2022-07-31 11:03:59 +02:00
|
|
|
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
2020-12-26 23:36:50 +01:00
|
|
|
{
|
2022-07-31 11:03:59 +02:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.magic_rb.grub;
|
|
|
|
in {
|
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 = {};
|
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
|
2021-03-14 10:58:29 +01:00
|
|
|
devices = mkOption {
|
|
|
|
description = "GRUB devices for legacy";
|
|
|
|
default = [];
|
2021-05-30 11:19:34 +02:00
|
|
|
type = with types; listOf string;
|
2021-03-14 10:58:29 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2022-07-31 11:03:59 +02:00
|
|
|
devices =
|
|
|
|
if cfg.efi.enable
|
|
|
|
then ["nodev"]
|
|
|
|
else cfg.devices;
|
2021-03-14 10:58:29 +01:00
|
|
|
};
|
2020-12-26 23:36:50 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|