mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-10 01:33:11 +01:00
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.
38 lines
918 B
Nix
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")
|
|
'';
|
|
}
|