Nixpkgs: How to get sha256sum (or any other) of source archive?

Created on 19 Nov 2017  Â·  4Comments  Â·  Source: NixOS/nixpkgs

Issue description

output path ‘/nix/store/i1xf3x515ncsrpxlrda23z95r8xa3j37-source’ has r:sha256 hash ‘0xv8fm67p2wkkv86v68hxx5fkb7lm906cr5v8hl6bf2hcfhx94yi’ when ‘43aa7e99dc9a476199746398a1478f4346d67f28adbe1e6a2633f7b19eaca2d7’ was expected

But why?
I get this sum with command sha256sum path_to_archive.tar.gz.

Most helpful comment

The reason for the mismatch in this case is that Nix is computing the hash of the archive's contents not the archive itself.

All 4 comments

Either nix-hash for files outside of nix store or nix-prefetch-url '<nixpkgs>' -A hello.src for nixpkgs attributes or nix-prefetch-url "http://example.com/file" for urls.

The reason for the mismatch in this case is that Nix is computing the hash of the archive's contents not the archive itself.

... as /nix/store/i1xf3x515ncsrpxlrda23z95r8xa3j37-source is not an archive but a directory tree.

nix-prefetch-url --type sha256 --unpack https://github.com/path/to/archive.tar.gz works fine.
Thanks you so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edolstra picture edolstra  Â·  3Comments

spacekitteh picture spacekitteh  Â·  3Comments

langston-barrett picture langston-barrett  Â·  3Comments

yawnt picture yawnt  Â·  3Comments

ghost picture ghost  Â·  3Comments