From 7a6f4790282d001e2c7adbdaa4806f8beed02ddb Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Wed, 23 Jul 2025 20:37:33 -0600 Subject: sys/boot: rename sb.nix -> secure-boot.nix --- sys/boot/secure-boot.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 sys/boot/secure-boot.nix (limited to 'sys/boot/secure-boot.nix') 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" ]; + }; +} -- cgit v1.2.3