summaryrefslogtreecommitdiff
path: root/sys/boot/secure-boot.nix
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2025-07-23 20:37:33 -0600
committerAlejandro Soto <alejandro@34project.org>2025-07-23 20:37:33 -0600
commit7a6f4790282d001e2c7adbdaa4806f8beed02ddb (patch)
tree59e4bd556c6d868afc68cab45c58631b39963da5 /sys/boot/secure-boot.nix
parent9d01e6dd2213dccd566c6204bd81465d3da68e46 (diff)
sys/boot: rename sb.nix -> secure-boot.nix
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" ];
+ };
+}