Merge pull request #285315 from jmbaur/sysupdate-fixes

nixos/sysupdate: allow lists in sysupdate config
This commit is contained in:
Will Fancher 2024-02-07 03:01:49 -05:00 committed by GitHub
commit ee9becfdfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View File

@ -3,7 +3,7 @@
let
cfg = config.systemd.sysupdate;
format = pkgs.formats.ini { };
format = pkgs.formats.ini { listToValue = toString; };
definitionsDirectory = utils.systemdUtils.lib.definitions
"sysupdate.d"
@ -79,7 +79,7 @@ in
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 = {

View File

@ -23,8 +23,8 @@ in
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
@ -39,15 +39,15 @@ in
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" ];
};
};
};
@ -61,6 +61,6 @@ in
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)
'';
}