mirror of
https://github.com/NixOS/nix.git
synced 2025-11-27 04:30:59 +01:00
Tarball trees: Propagate lastModified
This makes them behave consistently with GitHub/GitLab flakes.
(cherry picked from commit 81045f243f)
This commit is contained in:
parent
a0f07ae3fa
commit
8c9e4668b2
2 changed files with 7 additions and 1 deletions
|
|
@ -234,7 +234,7 @@ struct CurlInputScheme : InputScheme
|
|||
if (type != inputType()) return {};
|
||||
|
||||
// FIXME: some of these only apply to TarballInputScheme.
|
||||
std::set<std::string> allowedNames = {"type", "url", "narHash", "name", "unpack", "rev", "revCount"};
|
||||
std::set<std::string> allowedNames = {"type", "url", "narHash", "name", "unpack", "rev", "revCount", "lastModified"};
|
||||
for (auto & [name, value] : attrs)
|
||||
if (!allowedNames.count(name))
|
||||
throw Error("unsupported %s input attribute '%s'", *type, name);
|
||||
|
|
@ -312,6 +312,9 @@ struct TarballInputScheme : CurlInputScheme
|
|||
input = immutableInput;
|
||||
}
|
||||
|
||||
if (result.lastModified && !input.attrs.contains("lastModified"))
|
||||
input.attrs.insert_or_assign("lastModified", uint64_t(result.lastModified));
|
||||
|
||||
return {result.tree.storePath, std::move(input)};
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue