Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Last active February 28, 2019 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbbx6spp/1be590e8208f0d9bae8e9c350999d915 to your computer and use it in GitHub Desktop.
Save mbbx6spp/1be590e8208f0d9bae8e9c350999d915 to your computer and use it in GitHub Desktop.
Answer to common question: how do I find the SHA256 for a fetchGitHub in Nix without getting it from the error message?

Question

I just got asked this question: How do I find the SHA256 for a fetchGitHub in Nix expressions without faking it and getting it from the error message?

Answer

Install nix-prefetch-github:

$ nix-env -i nix-prefetch-github
installing 'nix-prefetch-github-1.3'
these paths will be fetched (0.67 MiB download, 3.24 MiB unpacked):
...
  1. Profit:
$ nix-prefetch-github --rev v0.6.4 yaoweibin ngx_http_substitutions_filter_module
{
    "owner": "yaoweibin",
    "repo": "ngx_http_substitutions_filter_module",
    "rev": "v0.6.4",
    "sha256": "0q86cv0mfffh43id5xanywyhpd7b0jijrmk8y311c13l9ajrd2rx"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment