about summary refs log tree commit diff
path: root/modules/secure-boot.nix
blob: 7f079e4f5dbcea7b74f9bb72253b3739fd37f8e2 (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
{ config, inputs, pkgs, lib, ... }:

let
  cfg = config.modules.secure-boot;
in
{
  imports = [
    inputs.lanzaboote.nixosModules.lanzaboote
  ];

  options.modules.secure-boot = {
    enable = lib.mkEnableOption "Secure boot with lanzaboote";
  };

  config = lib.mkIf cfg.enable {
    boot.lanzaboote.enable = true;
    boot.lanzaboote.pkiBundle = "/etc/secureboot";

    # Managed by lanzaboote
    boot.loader.systemd-boot.enable = lib.mkForce false;

    modules.persistence.directories = [
      "/etc/secureboot"
    ];

    environment.systemPackages = [ pkgs.sbctl ];
  };
}