about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/systemd-boot.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-02-26 16:20:28 +0100
committerAlyssa Ross <hi@alyssa.is>2024-02-26 16:20:28 +0100
commit647438344bfc1f77791391e2b4f98eef865c63dc (patch)
treeef580867fc6cc413940e4330d939cf1afda082cb /nixpkgs/nixos/tests/systemd-boot.nix
parentb084c6a0fab7f32c904c5c8e8db8dddcefbe507f (diff)
parente3474e1d1e53b70e2b2af73ea26d6340e82f6b8b (diff)
downloadnixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.gz
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.bz2
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.lz
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.xz
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.zst
nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.zip
Merge commit 'e3474e1d1e53'
Diffstat (limited to 'nixpkgs/nixos/tests/systemd-boot.nix')
-rw-r--r--nixpkgs/nixos/tests/systemd-boot.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/systemd-boot.nix b/nixpkgs/nixos/tests/systemd-boot.nix
index c0b37a230df0..ce3245f3d862 100644
--- a/nixpkgs/nixos/tests/systemd-boot.nix
+++ b/nixpkgs/nixos/tests/systemd-boot.nix
@@ -39,6 +39,32 @@ in
     '';
   };
 
+  # Test that systemd-boot works with secure boot
+  secureBoot = makeTest {
+    name = "systemd-boot-secure-boot";
+
+    nodes.machine = {
+      imports = [ common ];
+      environment.systemPackages = [ pkgs.sbctl ];
+      virtualisation.useSecureBoot = true;
+    };
+
+    testScript = ''
+      machine.start(allow_reboot=True)
+      machine.wait_for_unit("multi-user.target")
+
+      machine.succeed("sbctl create-keys")
+      machine.succeed("sbctl enroll-keys --yes-this-might-brick-my-machine")
+      machine.succeed('sbctl sign /boot/EFI/systemd/systemd-bootx64.efi')
+      machine.succeed('sbctl sign /boot/EFI/BOOT/BOOTX64.EFI')
+      machine.succeed('sbctl sign /boot/EFI/nixos/*bzImage.efi')
+
+      machine.reboot()
+
+      assert "Secure Boot: enabled (user)" in machine.succeed("bootctl status")
+    '';
+  };
+
   # Check that specialisations create corresponding boot entries.
   specialisation = makeTest {
     name = "systemd-boot-specialisation";