Actually, the attribute narHash does seem to apply to both flakerefs and inputs equally well. I found the documentation somewhat confusing since the attribute narHash is filed under the Flake reference attributes subheading and Flake references or flakerefs are described as a way to specify the location of a flake, not necessarily an input.
For future reference, for the package above that is giving an evaluation error on Hydra, the following attribute set build locally with the --restrict-eval flag:
inputs.bearssl-src = {
type = "git";
url = "https://www.bearssl.org/git/BearSSL";
narHash = "sha256-Mdkfgq8v5n1yKnSoaQBVjwF6JdT76RoZfdv44XT1ivI=";
flake = false;
};
I also bumped into this issue. Using nix-prefetch-git to grab the hash is not enough as it will throw a hash 'some-hash' is not SRI, it needs to be converted to SRI format beforehand with nix hash to-sri --type sha256 some-hash .
It’s also worth noting that the narHash attribute will not be recognized if the git+https URL form is given. The following will throw error: unexpected flake input attribute 'narHash':
inputs.bearssl-src = {
url = "git+https://www.bearssl.org/git/BearSSL";
narHash = "sha256-Mdkfgq8v5n1yKnSoaQBVjwF6JdT76RoZfdv44XT1ivI=";
flake = false;
};