summaryrefslogtreecommitdiff
path: root/sys/boot/chain.nix
blob: c726cf8077a097fa32b21c39834b2f3195d6131c (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
{ config, lib, pkgs, ... }:
with lib; let
  cfg = config.local.boot;
in
{
  options.local.boot = {
    enable = mkEnableOption "system boot";

    loader = mkOption {
      type = types.enum [ "grub" "systemd-boot" ];
    };

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

  config = mkIf cfg.enable {
    boot = {
      kernelPackages = cfg.kernel;

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