# Haskell-stack build fails

**URL:** https://discourse.nixos.org/t/haskell-stack-build-fails/3289
**Category:** Help
**Created:** [June 27, 2019, 5:25am UTC](https://discourse.nixos.org/t/haskell-stack-build-fails/3289 "2019-06-27T05:25:28Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![jojo](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jojo/32/2139_2.png) [@jojo](https://discourse.nixos.org/u/jojo)
#### Post date: [July 2, 2019, 2:11pm UTC](https://discourse.nixos.org/t/haskell-stack-build-fails/3289/5 "2019-07-02T14:11:06Z")

</div>

Since I’m still stuck, here is a detailed explanation of what I did.  
(I’m on NixOS 19.03, I use ghc-8.6.5 and stack 2.1.1.1)

1. Install `exercism` package (`nix-env -i exercism`)
2. Then `exercism download --exercise=hello-world --track=haskell` will download and install the data in `/home/jlucas/exercism/haskell/hello-world`.
3. After `cd /home/jlucas/exercism/haskell/hello-world`, in the file `./stack.yaml`, I added `compiler: ghc-8.6.5` (or whatever is your system version I guess)
4. Next `stack build` works for me
5. But `stack test` returns the next error log (I only pasted relevant lines)

```auto
...
WARNING: Ignoring stm's bounds on base (>=4.3 && <4.12); using base-4.12.0.0.
...
stm > Building library for stm-2.4.5.0..
...
stm > /run/user/1000/stack-a8a4ca0abf4d9831/stm-2.4.5.0/Control/Monad/STM.hs:34:9: error: Not in scope: ‘always’
...
stm > /run/user/1000/stack-a8a4ca0abf4d9831/stm-2.4.5.0/Control/Monad/STM.hs:35:9: error: Not in scope: ‘alwaysSucceeds’
...
-- While building package stm-2.4.5.0 using:
      /home/jlucas/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.4.0.1 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
Progress 14/18

```

The error seems to be caused by the test dependency, `stm`, that cannot be built, isn’t it ?

Just to check, I verified that I could create an empty stack project. from scratch, following the [guide](https://docs.haskellstack.org/en/stable/GUIDE/). Here is what I did

1. At first, `stack new helloworld`, returned the error

2. Thus, in `~/.stack/config.yaml` I disabled nix with

3. Next, I did,

4. Thus, in `~/.stack/config.yaml` I re-enabled nix :

5. `stack test` also worked.  
Thus, at the end, I was able to build a full project from scratch. What was surprising is that I had to first disable nix to create the project, then to enable nix to build and test the project.

---

_[View the full topic](https://discourse.nixos.org/t/haskell-stack-build-fails/3289)._
