diff options
author | dramforever <dramforever@live.com> | 2021-03-02 21:56:50 +0800 |
---|---|---|
committer | dramforever <dramforever@live.com> | 2021-03-02 21:56:50 +0800 |
commit | fc6bfb261d50102016ed812ecf9949d41fe539f7 (patch) | |
tree | f398fd06be27da2b7cac015f9c8a96f775b5fed5 /src/libfetchers/fetchers.hh | |
parent | e64cf8e0a330590ef200359b91f98332e46791c7 (diff) |
libfetchers/tarball: Lock on effectiveUrl
Basically, if a tarball URL is used as a flake input, and the URL leads
to a redirect, the final redirect destination would be recorded as the
locked URL.
This allows tarballs under https://nixos.org/channels to be used as
flake inputs. If we, as before, lock on to the original URL it would
break every time the channel updates.
Diffstat (limited to 'src/libfetchers/fetchers.hh')
-rw-r--r-- | src/libfetchers/fetchers.hh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libfetchers/fetchers.hh b/src/libfetchers/fetchers.hh index a72cfafa4..c6b219c02 100644 --- a/src/libfetchers/fetchers.hh +++ b/src/libfetchers/fetchers.hh @@ -145,7 +145,13 @@ DownloadFileResult downloadFile( bool immutable, const Headers & headers = {}); -std::pair<Tree, time_t> downloadTarball( +struct DownloadTarballMeta +{ + time_t lastModified; + std::string effectiveUrl; +}; + +std::pair<Tree, DownloadTarballMeta> downloadTarball( ref<Store> store, const std::string & url, const std::string & name, |