summaryrefslogtreecommitdiff
path: root/sys/core/bootloader.nix
blob: 292679e41d1e8e20454c320f685073d9b435ea43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ config, lib, ... }:
let
  cfg = config.szpont.sys.core.bootloader;
in
{
  options.szpont.sys.core.bootloader = lib.mkOption {
    type = lib.types.enum [ "systemd-boot" "grub" "none" ];
    default = "systemd-boot";
    description = "Which bootloader to use";
  };

  config = lib.mkMerge [
    {
      boot.loader.efi.canTouchEfiVariables = true;
      boot.supportedFilesystems = [ "ntfs" ];
      boot.kernelParams = [ "quiet" "splash" ];
    }

    (lib.mkIf (cfg == "systemd-boot") {
      boot.loader = {
        systemd-boot.enable = true;
        systemd-boot.editor = false;
        timeout = 0;
      };
    })

    (lib.mkIf (cfg == "grub") {
      boot.loader.grub = {
        enable = true;
        device = "nodev";
        efiSupport = true;
        useOSProber = true;
      };
    })
  ];
}