summaryrefslogtreecommitdiff
path: root/sys/core/bootloader.nix
blob: 35644515df1bc221ce7c4fbb11d856d6e89afe3c (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
37
38
39
40
41
{ config, lib, ... }:
let
  cfg = config.sys.core.bootloader;
in
{
  options.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 = {
        timeout = 3;
        efi.efiSysMountPoint = "/boot";
        grub = {
          enable = true;
          device = "nodev";
          efiSupport = true;
          useOSProber = true;

          default = 2;
        };
      };
    })
  ];
}