purescript-native icon indicating copy to clipboard operation
purescript-native copied to clipboard

"attribute 'haskell-nix' missing" when building with nix

Open joprice opened this issue 4 years ago • 3 comments

I'm trying build the master branch from source in an existing nix project:

import
        (pkgs.fetchFromGitHub
          {
            owner = "andyarvanitis";
            repo = "purescript-native";
            rev = "7a3f114fb158a250c6130c93752719b6d69c606a";
            sha256 = "1j0d25g5j3givf4shhnvnxqj54jjxzsj2sdm53xcirp7d9w78hmj";
          })
        {}

I get the error attribute 'haskell-nix' missing, at /nix/store/jbhar7ldha5r2dmxqj0j912i2k7zvn9k-source/default.nix:18:1

I tried copying the pkgs.haskell.lib.buildStackProject expression from stack.nix directly into my project, but I got different error from stack

Received ExitFailure 1 when running                                                                                   Raw command: /private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5.temp/ghc-8.6.5/configure --prefix=/private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5/
Run from: /private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5.temp/ghc-8.6.5/


Error: Error encountered while configuring GHC with
         /private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5.temp/ghc-8.6.5/configure --prefix=/private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5/
         run in /private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5.temp/ghc-8.6.5/

       The following directories may now contain files, but won't be used by stack:
         - /private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5.temp/
         - /private/var/folders/8b/yry_95qs2n1f4kpz_r94606w0000gn/T/nix-build-default-stack-shell.drv-0/.stack/programs/x86_64-osx-nix/ghc-8.6.5/

       For more information consider rerunning with --verbose flag

It suggests adding the verbose flag to debug further, but I'm not sure how to pass that down from nix.

Is building the project like this not a normal pattern? I'm not too familiar with nix yet.

joprice avatar Sep 29 '20 00:09 joprice

Unfortunately I don't really use nix myself, so I can't be of help. The nix support we have is from other contributors like @kayhide. However, I can say that the master branch is no longer active. The default branch is golang, and there is a cpp branch for the C++ backend. As far as nix support goes, I think only the golang branch has been updated for it recently.

andyarvanitis avatar Sep 29 '20 23:09 andyarvanitis

Yeah, I setup the nix config to build the golang version.

I just tried it on the current golang branch and found that does not build. I will take a look.

kayhide avatar Sep 30 '20 01:09 kayhide

My revision is actually from the golang branch. I didn't even notice it wasn't master because it's set as the repo's default branch.

I was able to build the project using stack without hitting the second issue. I now realize that the stack.nix is meant for use by stack, not for direct consumption, so maybe stack is running it differently.

joprice avatar Sep 30 '20 12:09 joprice