From 7f14626ab0eac1d585999c59071a2984e4b6acae Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 14 Dec 2023 17:23:54 -0500 Subject: [PATCH] nixos-http: support versioned releases Signed-off-by: Adam Stephens --- sources/nixos-http.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sources/nixos-http.go b/sources/nixos-http.go index 0ad3fbb8..e9b07a95 100644 --- a/sources/nixos-http.go +++ b/sources/nixos-http.go @@ -12,7 +12,13 @@ type nixos struct { } func (s *nixos) Run() error { - tarballURL := fmt.Sprintf("https://hydra.nixos.org/job/nixos/trunk-combined/nixos.lxdContainerImage.%s-linux/latest/download-by-type/file/system-tarball", s.definition.Image.ArchitectureMapped) + hydraRelease := fmt.Sprintf("release-%s", s.definition.Image.Release) + + if s.definition.Image.Release == "unstable" { + hydraRelease = "trunk-combined" + } + + tarballURL := fmt.Sprintf("https://hydra.nixos.org/job/nixos/%s/nixos.lxdContainerImage.%s-linux/latest/download-by-type/file/system-tarball", hydraRelease, s.definition.Image.ArchitectureMapped) fpath, err := s.DownloadHash(s.definition.Image, tarballURL, "", nil) if err != nil {