···252 '';
253 };
25400000000000000000000000000000255 # Some UEFI firmwares fail on large reads. Now that systemd-boot loads initrd
256 # itself, systems with such firmware won't boot without this fix
257 uefiLargeFileWorkaround = makeTest {
···252 '';
253 };
254255+ garbage-collect-entry = makeTest {
256+ name = "systemd-boot-switch-test";
257+ meta.maintainers = with pkgs.lib.maintainers; [ julienmalka ];
258+259+ nodes = {
260+ inherit common;
261+ machine = { pkgs, nodes, ... }: {
262+ imports = [ common ];
263+264+ # These are configs for different nodes, but we'll use them here in `machine`
265+ system.extraDependencies = [
266+ nodes.common.system.build.toplevel
267+ ];
268+ };
269+ };
270+271+ testScript = { nodes, ... }:
272+ let
273+ baseSystem = nodes.common.system.build.toplevel;
274+ in
275+ ''
276+ machine.succeed("nix-env -p /nix/var/nix/profiles/system --set ${baseSystem}")
277+ machine.succeed("nix-env -p /nix/var/nix/profiles/system --delete-generations 1")
278+ machine.succeed("${baseSystem}/bin/switch-to-configuration boot")
279+ machine.fail("test -e /boot/loader/entries/nixos-generation-1.conf")
280+ machine.succeed("test -e /boot/loader/entries/nixos-generation-2.conf")
281+ '';
282+ };
283+284 # Some UEFI firmwares fail on large reads. Now that systemd-boot loads initrd
285 # itself, systems with such firmware won't boot without this fix
286 uefiLargeFileWorkaround = makeTest {