Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build static-stack for stack(source code) v2.1.3 #81

Closed
thautwarm opened this issue Feb 21, 2020 · 7 comments
Closed

Cannot build static-stack for stack(source code) v2.1.3 #81

thautwarm opened this issue Feb 21, 2020 · 7 comments

Comments

@thautwarm
Copy link

Environment

Ubuntu 16.04(Virtualbox)

System GHC: (base) redy@redy-VirtualBox:~/Desktop/static-haskell-nix/static-stack$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.10.3 (installed directly from apt)

Reproduction

  1. clone Stack, checkout to tag v2.1.3 to ~/Desktop/stack.
  2. clone this project to ~/Desktop/stack-haskell-nix, get in and git submodule init && git submodule update --recursive
  3. cd static-stack , $(nix-build --no-link -A fullBuildScript --argstr stackDir /home/redy/Desktop/stack):
...
building '/nix/store/l12csrx3ngsvd8pqz8x7hbwgmx838p6v-nix-prefetch-scripts.drv'...

Ensuring git version is >= 2 ...
Ensuring cabal version is >= 2 ...
stack2nix: haskell.compiler.ghc822 failed to build via nix:
error: attribute 'ghc822' in selection path 'haskell.compiler.ghc822' not found

CallStack (from HasCallStack):
  error, called at src/Stack2nix/Util.hs:79:22 in stack2nix-0.2.3-6XVhBtEop6H39w4gsmgj0D:Stack2nix.Util
@thautwarm thautwarm changed the title Cannot build static-stack with stack v2.1.3 Cannot build static-stack for stack(source code) v2.1.3 Feb 21, 2020
@nh2
Copy link
Owner

nh2 commented Feb 21, 2020

Hi, that's right, you need to build with Stack's stack-lts-12.yaml file because ghc822 is no longer in nixpkgs; see how my CI script does it:

# Use lts-12 because ghc822 is no longer in nixpkgs

Alternatively you can use an older commit of static-haskell-nix.

@nh2 nh2 closed this as completed in 95fa110 Feb 21, 2020
@nh2
Copy link
Owner

nh2 commented Feb 21, 2020

I've updated the README accordingly in 95fa110, sorry that I didn't document it there when I made the CI fix!

@thautwarm
Copy link
Author

Thanks, I'm trying with this configuration.

Besides, I'd ask if I change cabalPackageName in default.nix to my project name, and point the path of my local project, will it be a correct way to build my stack project into static executable?

@nh2
Copy link
Owner

nh2 commented Feb 21, 2020

@thautwarm Pretty much yes, but start with the template from static-stack2nix-builder-example (https://github.com/nh2/static-haskell-nix/tree/master/static-stack2nix-builder-example), which is made for this purpose, not with static-stack (which is also based on that template but already a bit specialised).

If you encounter any problems with building your project, file me an issue!

@thautwarm
Copy link
Author

@nh2 Thanks! As building once costs quite a long time your convince means a lot to me.

A small question:

Does this exactly mean I can use lts-13.26? Or should I change it to compiler = "lts-13.26"?

compiler = "ghc865"; # matching stack.yaml

I'm new to Nix, and it's very kind of you to give helps.

@nh2
Copy link
Owner

nh2 commented Feb 21, 2020

Hey,

no the compiler is correct. It contains the GHC version matching the one in the Stackage LTS you are using, for example for lts-13.26 visit https://www.stackage.org/lts-13.26 and it shows at the top

LTS Haskell 13.26 (ghc-8.6.5)

so ghc865 is the right one.

building once costs quite a long time

If you use my cachix (https://github.com/nh2/static-haskell-nix#binary-caches-for-faster-building-optional) then you may save a lot of time because you will not need to build big parts (like GHC) from source.

@thautwarm
Copy link
Author

Thanks, in fact I know that but still not sure...
Also I'm using cachix but I'm not sure if it is working because I still need to wait for quite a few minutes before a build exception got raised(my project relies on a big one, which raises errors like incorrect locale)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants