cabal2nix icon indicating copy to clipboard operation
cabal2nix copied to clipboard

file:// will ignore a cabal file

Open Profpatsch opened this issue 3 years ago • 1 comments

When I run

> cabal2nix file://./yarn2nix/yarn2nix.cabal > yarn2nix/yarn2nix.nix
error: unable to download 'https://hackage.haskell.org/package/yarn2nix-0.9.0.tar.gz': HTTP error 404 ('Not Found')

       response body:

       Package not found: No such package version for yarn2nix
*** cannot compute hash. (Not a hackage project?)
 If your project is not on hackage, please supply the path to the root directory of
 the project, not to the cabal file.

 If your project is on hackage but you still want to specify the hash manually, you
 can use the --sha256 option.

cabal2nix starts downloading things and complains.

I expect it to use the .cabal file and convert it to a nix file.

Profpatsch avatar Mar 04 '22 08:03 Profpatsch

cabal2nix starts downloading things and complains.

Isn't this expected, since it needs to get the hash of a clean tarball? The README states:

Alternatively [...] a file:///local/path/pkg.cabal URI that doesn't depend on network access. However, if the source hash is not already in cabal2nix's cache or provided using the --sha256 option, cabal2nix still needs to download the source code to compute the hash, which still causes network traffic.

In 0.9.0 of yarn2nix, which is not released on hackage, specifying the path to the root directory of the project as mentioned in the error behaves as expected; cabal2nix file://./yarn2nix/. outputs a Nix expression, whereas cabal2nix file://./yarn2nix/yarn2nix.cabal gives me the error.

leungbk avatar Apr 27 '22 04:04 leungbk