blob: 3e874c3f37eb98d7461c7cc01f14e8c3ea9a003c (
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
43
44
45
46
47
|
{ config, lib, pkgs, ... }:
with lib; let
cfg = config.local.boot.secureBoot;
pkiBundle =
if cfg.legacyPath
then "/etc/secureboot"
else "/var/lib/sbctl";
in
{
options.local.boot.secureBoot = {
enable = mkEnableOption "secure boot";
legacyPath = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion = config.local.boot.efi.enable;
message = "secure boot requires EFI";
}
{
assertion = config.local.boot.loader == "systemd-boot";
message = "lanzaboote requires systemd-boot";
}
];
boot = {
loader.systemd-boot.enable = mkForce false;
lanzaboote = {
enable = true;
inherit pkiBundle;
};
};
environment.systemPackages = [
pkgs.sbctl
];
local.boot.impermanence.directories = [ pkiBundle ];
};
}
|