Skip to content

Commit

Permalink
nixos/systemd-boot: add test for devicetree
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbaur committed Aug 1, 2024
1 parent fca8ee9 commit 22199c7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion nixos/tests/systemd-boot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,23 @@ rec {
imports = [ common ];
specialisation.something.configuration = {
boot.loader.systemd-boot.sortKey = "something";

# Since qemu will dynamically create a devicetree blob when starting
# up, it is not straight forward to create an export of that devicetree
# blob without knowing before-hand all the flags we would pass to qemu
# (we would then be able to use `dumpdtb`). Thus, the following config
# will not boot, but it does allow us to assert that the boot entry has
# the correct contents.
boot.loader.systemd-boot.installDeviceTree = pkgs.stdenv.hostPlatform.isAarch64;
hardware.deviceTree.name = "dummy.dtb";
hardware.deviceTree.package = lib.mkForce (pkgs.runCommand "dummy-devicetree-package" { } ''
mkdir -p $out
cp ${pkgs.emptyFile} $out/dummy.dtb
'');
};
};

testScript = ''
testScript = { nodes, ... }: ''
machine.start()
machine.wait_for_unit("multi-user.target")
Expand All @@ -188,6 +201,10 @@ rec {
machine.succeed(
"grep 'sort-key something' /boot/loader/entries/nixos-generation-1-specialisation-something.conf"
)
'' + pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isAarch64 ''
machine.succeed(
"grep 'devicetree .*dummy' /boot/loader/entries/nixos-generation-1-specialisation-something.conf"
)
'';
};

Expand Down

0 comments on commit 22199c7

Please sign in to comment.