nixpkgs/nixos/tests/limine/secure-boot.nix
John Titor e53e10938c
nixosTests.limine.secureBoot: fix secure boot check
An easier way to check if secureBoot is enabled is by running mokutil --sb-state

We have to do this way now because on systemd v258 `bootctl status` returns non 0 value if systemd-boot is not properly installed, which is to be expected when using Limine.
2025-10-22 19:55:37 +05:30

38 lines
918 B
Nix

{ lib, pkgs, ... }:
{
name = "secureBoot";
meta = {
inherit (pkgs.limine.meta) maintainers;
};
meta.platforms = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
];
nodes.machine =
{ pkgs, ... }:
{
virtualisation.useBootLoader = true;
virtualisation.useEFIBoot = true;
virtualisation.useSecureBoot = true;
virtualisation.efi.OVMF = pkgs.OVMFFull.fd;
virtualisation.efi.keepVariables = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.limine.enable = true;
boot.loader.limine.efiSupport = true;
boot.loader.limine.secureBoot.enable = true;
boot.loader.limine.secureBoot.createAndEnrollKeys = true;
boot.loader.timeout = 0;
environment.systemPackages = [ pkgs.mokutil ];
};
testScript = ''
machine.start()
assert "SecureBoot enabled" in machine.succeed("mokutil --sb-state")
'';
}