input-output-hk/stack2nix

Cannot generate the stack2nix.nix file (failure on packages from git repo)

Closed this issue · 7 comments

nlewo commented

I try to generate the stack2nix.nix file of the stack2nix repository by using the stack2nix master built with Nix. But it fails on packages that come from git repositories. See the following log:

$ git rev-parse HEAD
9070f9173ae32f0be6f7830c41c8cfb8e780fdbf

$ /nix/store/d24r9j57sjinz98zjr595ian61n9p3qh-stack2nix-0.1.3.1/bin/stack2nix .
Ensuring git version is >= 2 ...
Ensuring cabal version is >= 2 ...

+ cabal2nix --subpath . --system x86_64-linux cabal://AC-Vector-2.3.2
+ cabal2nix --subpath . --system x86_64-linux cabal://ALUT-2.4.0.2
+ cabal2nix --subpath . --system x86_64-linux cabal://Agda-2.5.3
...
...
+ cabal2nix --revision e72fbdfe57941627633006fa1fb4003e26619424 --subpath . --system x86_64-linux https://github.com/NixOS/cabal2nix
...
...
+ cabal2nix --revision 0b58f1062d0a87b06bbae343d3c5a2f86ba26537 --subpath . --system x86_64-linux https://github.com/domenkozar/hackage-db
...
...
*** parsing cabal file: https://github.com/NixOS/cabal2nix/.: openFile: does not exist (No such file or directory)
error: hash ‘e72fbdfe57941627633006fa1fb4003e26619424’ has wrong length for hash type ‘sha256’
abort: HTTP Error 406: Not Acceptable
svn: E205000: Syntax error in revision argument 'e72fbdfe57941627633006fa1fb4003e26619424'
*** parsing cabal file: https://github.com/domenkozar/hackage-db/.: openFile: does not exist (No such file or directory)
error: hash ‘0b58f1062d0a87b06bbae343d3c5a2f86ba26537’ has wrong length for hash type ‘sha256’
abort: HTTP Error 406: Not Acceptable
svn: E205000: Syntax error in revision argument '0b58f1062d0a87b06bbae343d3c5a2f86ba26537'
+ cabal2nix --subpath . --system x86_64-linux ./.
bzr: ERROR: Not a branch: "https://github.com/NixOS/cabal2nix/".
stack2nix: user error (Failed to fetch source. Does the URL exist?)
bzr: ERROR: Not a branch: "https://github.com/domenkozar/hackage-db/".

So, I wonder how you have generated the stack2nix.nix file!

The git and cabal versions of my system:

$ cabal --version
cabal-install version 2.2.0.0
compiled using version 2.2.0.1 of the Cabal library 

$ git --version
git version 2.16.2

Huh, I don't get error: hash ‘e72fbdfe57941627633006fa1fb4003e26619424’ has wrong length for hash type ‘sha256’ locally. Can you write exact commands to run?

Could you try building #108

Should be merged to master now.

nlewo commented

Sorry, i didn't have too much time today. I just built it and tried to run stack2nix but I got this error:

/nix/store/xhbmp2r5dvqm3haqrm0f4kn704mpp3zh-stack2nix-0.1.3.1/bin/stack2nix ./
Ensuring git version is >= 2 ...
Ensuring cabal version is >= 2 ...
stack2nix: haskell.compiler.ghc843 failed to build via nix
CallStack (from HasCallStack):
  error, called at src/Stack2nix/Util.hs:79:22 in stack2nix-0.1.3.1-7GzZkAsptUFDfkytalEqLh:Stack2nix.Util

I don't know if this is related to your PR...

You need to set NIX_PATH to recent 18.03 or master branch.

nlewo commented

Ok, thanks.
I can now generate the stack2nix.nix file but I'm still not able to generate nix expressions from a stack.yaml that contains a package specified with the location keyword. I will provide more details in the next few days.

Do open an issue with steps to reproduce. I'm going to close this as duplicate of #102