{ inputs, lib, pkgs, ... }: { imports = [ inputs.lanzaboote.nixosModules.lanzaboote ]; environment.systemPackages = [ pkgs.sbctl ]; # Lanzaboote currently replaces the systemd-boot module. # This setting is usually set to true in configuration.nix # generated at installation time. So we force it to false # for now. boot.loader.systemd-boot.enable = lib.mkForce false; boot.lanzaboote = { enable = true; pkiBundle = "/var/lib/sbctl"; }; # Create and enroll Secure Boot keys on first boot systemd.services.sbctl-setup = { description = "Create and enroll Secure Boot keys"; wantedBy = [ "multi-user.target" ]; unitConfig.ConditionPathExists = "!/var/lib/sbctl/GUID"; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; }; script = '' echo "Creating Secure Boot keys..." ${pkgs.sbctl}/bin/sbctl create-keys ''; }; }