summaryrefslogtreecommitdiff
path: root/sys/boot/secure-boot.nix
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/secure-boot.nix')
-rw-r--r--sys/boot/secure-boot.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/boot/secure-boot.nix b/sys/boot/secure-boot.nix
new file mode 100644
index 0000000..bdf7f0f
--- /dev/null
+++ b/sys/boot/secure-boot.nix
@@ -0,0 +1,37 @@
+{ config, lib, pkgs, ... }:
+with lib; let
+ cfg = config.local.boot.secureBoot;
+in
+{
+ options.local.boot.secureBoot = {
+ enable = mkEnableOption "secure boot";
+ };
+
+ 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;
+ pkiBundle = "/etc/secureboot";
+ };
+ };
+
+ environment.systemPackages = [
+ pkgs.sbctl
+ ];
+
+ local.boot.impermanence.directories = [ "/etc/secureboot" ];
+ };
+}