From 527ea5380af7b08cd70714be89571782f80279c2 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Fri, 1 Mar 2024 10:34:51 -0800 Subject: [PATCH] Allow `narHash` or `treeHash` in Git archive inputs Without this, `nix build` fails because the lockfile doesn't include a `treeHash` for the Git archive inputs (e.g. GitHub), but as I understand it the `narHash` should be equivalent if it exists. --- src/libfetchers/github.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index f620a83b153..cee20e73b11 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -304,9 +304,9 @@ struct GitArchiveInputScheme : InputScheme bool isLocked(const Input & input) const override { /* Since we can't verify the integrity of the tarball from the - Git revision alone, we also require a Git tree hash for + Git revision alone, we also require a Git tree hash or NAR hash for locking. */ - return input.getRev().has_value() && getTreeHash(input).has_value(); + return input.getRev().has_value() && (getTreeHash(input).has_value() || input.getNarHash().has_value()); } std::optional experimentalFeature() const override