1 # Tests downloading a signed update aritfact from a server to a target machine.
2 # This test does not rely on the `systemd.timer` units provided by the
3 # `systemd-sysupdate` module but triggers the `systemd-sysupdate` service
4 # manually to make the test more robust.
9 gpgKeyring = import ./common/gpg-keyring.nix { inherit pkgs; };
12 name = "systemd-sysupdate";
14 meta.maintainers = with lib.maintainers; [ nikstur ];
17 server = { pkgs, ... }: {
18 networking.firewall.enable = false;
21 virtualHosts."server" = {
22 root = pkgs.runCommand "sysupdate-artifacts" { buildInputs = [ pkgs.gnupg ]; } ''
26 echo "nixos" > nixos_1.efi
27 sha256sum nixos_1.efi > SHA256SUMS
29 export GNUPGHOME="$(mktemp -d)"
30 cp -R ${gpgKeyring}/* $GNUPGHOME
32 gpg --batch --sign --detach-sign --output SHA256SUMS.gpg SHA256SUMS
45 Path = "http://server/";
46 MatchPattern = "nixos_@v.efi";
49 Path = "/boot/EFI/Linux";
50 MatchPattern = "nixos_@v.efi";
56 environment.etc."systemd/import-pubring.gpg".source = "${gpgKeyring}/pubkey.gpg";
61 server.wait_for_unit("nginx.service")
63 target.succeed("systemctl start systemd-sysupdate")
64 assert "nixos" in target.wait_until_succeeds("cat /boot/EFI/Linux/nixos_1.efi", timeout=5)