mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
Add trust-tarballs-from-git-forges setting
If enabled, GitHub flakerefs don't require a content hash, a Git revision is enough. Fixes #10297.
This commit is contained in:
parent
de101417eb
commit
46d9e70c20
2 changed files with 19 additions and 2 deletions
|
@ -78,7 +78,6 @@ struct FetchSettings : public Config
|
||||||
)",
|
)",
|
||||||
{}, true, Xp::Flakes};
|
{}, true, Xp::Flakes};
|
||||||
|
|
||||||
|
|
||||||
Setting<bool> useRegistries{this, true, "use-registries",
|
Setting<bool> useRegistries{this, true, "use-registries",
|
||||||
"Whether to use flake registries to resolve flake references.",
|
"Whether to use flake registries to resolve flake references.",
|
||||||
{}, true, Xp::Flakes};
|
{}, true, Xp::Flakes};
|
||||||
|
@ -94,6 +93,22 @@ struct FetchSettings : public Config
|
||||||
empty, the summary is generated based on the action performed.
|
empty, the summary is generated based on the action performed.
|
||||||
)",
|
)",
|
||||||
{}, true, Xp::Flakes};
|
{}, true, Xp::Flakes};
|
||||||
|
|
||||||
|
Setting<bool> trustTarballsFromGitForges{
|
||||||
|
this, true, "trust-tarballs-from-git-forges",
|
||||||
|
R"(
|
||||||
|
If enabled (the default), Nix will consider tarballs from
|
||||||
|
GitHub and similar Git forges to be locked if a Git revision
|
||||||
|
is specified,
|
||||||
|
e.g. `github:NixOS/patchelf/7c2f768bf9601268a4e71c2ebe91e2011918a70f`.
|
||||||
|
This requires Nix to trust that the provider will return the
|
||||||
|
correct contents for the specified Git revision.
|
||||||
|
|
||||||
|
If disabled, such tarballs are only considered locked if a
|
||||||
|
`narHash` attribute is specified,
|
||||||
|
e.g. `github:NixOS/patchelf/7c2f768bf9601268a4e71c2ebe91e2011918a70f?narHash=sha256-PPXqKY2hJng4DBVE0I4xshv/vGLUskL7jl53roB8UdU%3D`.
|
||||||
|
)"};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: don't use a global variable.
|
// FIXME: don't use a global variable.
|
||||||
|
|
|
@ -294,7 +294,9 @@ struct GitArchiveInputScheme : InputScheme
|
||||||
Git revision alone, we also require a NAR hash for
|
Git revision alone, we also require a NAR hash for
|
||||||
locking. FIXME: in the future, we may want to require a Git
|
locking. FIXME: in the future, we may want to require a Git
|
||||||
tree hash instead of a NAR hash. */
|
tree hash instead of a NAR hash. */
|
||||||
return input.getRev().has_value() && input.getNarHash().has_value();
|
return input.getRev().has_value()
|
||||||
|
&& (fetchSettings.trustTarballsFromGitForges ||
|
||||||
|
input.getNarHash().has_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<ExperimentalFeature> experimentalFeature() const override
|
std::optional<ExperimentalFeature> experimentalFeature() const override
|
||||||
|
|
Loading…
Reference in a new issue