What is the latest best practice to prefetch the hash?

Right, fetchFromGitHub hashes the extracted source directory, while nix-prefetch-url hashes the downloaded file by default. As you discovered you will need to use --unpack when you want to use the hash for fetchzip or fetchFromGitHub, which often uses fetchzip internally.

You can also just set the sha256 attribute to an empty string and Nix will tell you the correct one.

This is base-32 encoded hash, which sha256 attribute supports just as well.


In this case, there is an update script so you can just run the following in your Nixpkgs checkout:

nix-shell maintainers/scripts/update.nix --argstr commit true --argstr path treesheets

nixpkgs-update bot also does that periodically, someone just needs to notice the PR and merge it: treesheets: unstable-2022-03-12 -> unstable-2022-09-26 by r-ryantm · Pull Request #190656 · NixOS/nixpkgs · GitHub.

2 Likes