summaryrefslogtreecommitdiff
path: root/sys/boot/chain.nix
blob: 43edcb444bf6d5c0636f0a1866fe484a102509a2 (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,
  pkgs,
  ...
}:
with lib; let
  cfg = config.local.boot;
in {
  options.local.boot = {
    loader = mkOption {
      type = types.enum ["none" "grub" "systemd-boot"];
    };

    kernel = mkOption {
      type = types.raw;
    };
  };

  config = mkIf (cfg.loader != "none") {
    boot = {
      kernelPackages = cfg.kernel;

      loader =
        if cfg.loader == "grub"
        then {
          grub = {
            enable = true;
            device = "nodev";
            efiSupport = true;
          };
        }
        else {
          systemd-boot = {
            enable = true;
            editor = true;
          };
        };
    };
  };
}