summaryrefslogtreecommitdiff
path: root/os/core/bootloader.nix
blob: da4305065f7bf90adb5e87ace153498314e06507 (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
42
{ config, lib, ... }:
let
  cfg = config.os.core.bootloader;
in
{
  options.os.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.consoleLogLevel = 0;
      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;
        };
      };
    })
  ];
}