input-output-hk / stack2nix

Generate nix expressions for Haskell projects
MIT License
98 stars 32 forks source link

`nix-build` fails due to missing package `githash` #147

Closed nikola-da closed 5 years ago

nikola-da commented 5 years ago

When I follow the instructions from the README.md, I get the following:

/tmp/stack2nix master
❯ nix-build .
error: anonymous function at /private/tmp/stack2nix/stack2nix.nix:32633:10 called without required argument 'githash', at /nix/store/pc3wdq5pfp48vr000jnna791g24szfcl-ef802feaceba073e3e5178af1b5d65f27f5cc93b.tar.gz-unpacked/pkgs/development/haskell-modules/make-package-set.nix:88:27
(use '--show-trace' to show detailed location information)

I'm using nix 2.1.3 on macOS High Sierra, with nixpkgs 18.03.

Looking at stack2nix.nix, githash argument to stack is not defined in the file.

clacke commented 5 years ago

NixOS with sandbox:

$ git bisect start; git bisect bad upstream/master; git bisect good fbb569b7759af7d77a4ac8ec2bd487427f191d53; git bisect run nix-build

[ . . . ]

891c6f939b0c2859a6ba352d20c869bf78d96ff9 is the first bad commit
commit 891c6f939b0c2859a6ba352d20c869bf78d96ff9
Author: Kirill Zaborsky <qrilka@gmail.com>
Date:   Fri Sep 14 09:00:09 2018 +0300

    Updated to stack prerelease 1.9
clacke commented 5 years ago

This issue describes the special case of a general bug. If I take the last good commit 891c6f93^, and use that build to get a nix expression for Bäckerei, I get a file that complains about not getting the parameter util, even though the cabal2nix call for util is shown while processing. So I just ran that call again and appended the definition to the other attributes, and I got a new error: It turned out that util was in fact already defined.

Is it the callPackage that comes from nixpkgs ghc that is broken?

EDIT: No, it's not a parameter that points to util, it's an inherit (pkgs) util call, see https://github.com/cryptiumlabs/backerei/blob/042f97ec9e9f542421134416f8ee0301c9bb749e/README.md#regenerating-releasenix from cryptiumlabs/backerei#10 .

891c6f93^ does not build if I let it generate its own stack2nix.nix. The checked-in stack2nix.nix was generated with an earlier version. Trying to find a revision of nixpkgs where nixpkgs stack2nix builds, that should be easier than finding a combination of revisions of stack2nix and nixpkgs that interact well.

Hm, actually OP described an attribute not being generated and I'm describing an attribute being ignored, so it sounds like two different issues. Disentangling them when troubleshooting would be hard work though, as the symptom is the same. I'll keep the troubleshooting to this shared issue.

clacke commented 5 years ago

That stack2nix.nix that worked was generated in 214078d7b3a , probably with that same version of stack2nix. Verifying that it can generate its own.

No, it can't. If I generate an s2n.nix and try to build from that I get a missing dependency during the build of stack (but a compile error, no Nix errors). The difference between the original stack2nix.nix and the generated s2n.nix is in some editedCabalFile and revision attributes.

domenkozar commented 5 years ago

This is fixed now, can you retry?

clacke commented 5 years ago

Confirmed. It builds from stack2nix.nix and it can generate a new one that works as well.

clacke commented 5 years ago

Re: the Bäckerei thing I identified the problem and will open a different issue for that.