nmattia / niv

Easy dependency management for Nix projects
https://github.com/nmattia/niv
MIT License
1.55k stars 77 forks source link

Hash mismatch #289

Closed typetetris closed 3 years ago

typetetris commented 3 years ago

Trying to download a tarball from an url not ending in .tar or .tgz or something

haskell.nix
  project: 91
  url: https://<some-gitlab>/api/v4/projects/91/repository/archive.tar.gz?sha=7e7b43afb30e846c0e3bcc8abe8c0149062f7110
  url_template: https://<some-gitlab>/api/v4/projects/<project>/repository/archive.tar.gz?sha=<rev>
  type: tarball
  sha256: 0pymh6l86hma8cdr0j7hnq3i4rplq2ngcn2vkcy63l86mqvfip6z
  rev: 7e7b43afb30e846c0e3bcc8abe8c0149062f7110

the sha256 is not correct.

I added the dependency like that:

 niv add -t 'https://<some-gitlab>/api/v4/projects/<project>/repository/archive.tar.gz?sha=<rev>' -T tarball -s project=91 -s rev=7e7b43afb30e846c0e3bcc8abe8c0149062f7110 haskell.nix

where <some-gitlab> was of course the original server.

I was under the impression -T tarball should lead to nix-prefetch-url being called with --unpack but that doesn't seem the case.

nix-prefetch-url output without --unpack

0pymh6l86hma8cdr0j7hnq3i4rplq2ngcn2vkcy63l86mqvfip6z

and with --unpack

19mpg51gp1j40palrzqlfx4p7j3ij90n1r9c4x843mr00qn8h999

This being the desired sha256.

I couldn't reopen #185 so I made a new hash mismatch ticket.