Merge pull request #285315 from jmbaur/sysupdate-fixes

nixos/sysupdate: allow lists in sysupdate config

Changed files
+9 -9
nixos
modules
system
boot
systemd
tests
+2 -2
nixos/modules/system/boot/systemd/sysupdate.nix
···
let
cfg = config.systemd.sysupdate;
-
format = pkgs.formats.ini { };
+
format = pkgs.formats.ini { listToValue = toString; };
definitionsDirectory = utils.systemdUtils.lib.definitions
"sysupdate.d"
···
Source = {
Type = "url-file";
Path = "https://download.example.com/";
-
MatchPattern = "nixos_@v.efi.xz";
+
MatchPattern = [ "nixos_@v+@l-@d.efi" "nixos_@v+@l.efi" "nixos_@v.efi" ];
};
Target = {
+7 -7
nixos/tests/systemd-sysupdate.nix
···
mkdir -p $out
cd $out
-
echo "nixos" > nixos_1.efi
-
sha256sum nixos_1.efi > SHA256SUMS
+
echo "nixos" > nixos_1.txt
+
sha256sum nixos_1.txt > SHA256SUMS
export GNUPGHOME="$(mktemp -d)"
cp -R ${gpgKeyring}/* $GNUPGHOME
···
systemd.sysupdate = {
enable = true;
transfers = {
-
"uki" = {
+
"text-file" = {
Source = {
Type = "url-file";
Path = "http://server/";
-
MatchPattern = "nixos_@v.efi";
+
MatchPattern = "nixos_@v.txt";
};
Target = {
-
Path = "/boot/EFI/Linux";
-
MatchPattern = "nixos_@v.efi";
+
Path = "/";
+
MatchPattern = [ "nixos_@v.txt" ];
};
};
};
···
server.wait_for_unit("nginx.service")
target.succeed("systemctl start systemd-sysupdate")
-
assert "nixos" in target.wait_until_succeeds("cat /boot/EFI/Linux/nixos_1.efi", timeout=5)
+
assert "nixos" in target.wait_until_succeeds("cat /nixos_1.txt", timeout=5)
'';
}