Haskell-stack build fails

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)
...
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. Here is what I did

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

    Cannot determine project root directory for Docker sandbox.
    
  2. Thus, in ~/.stack/config.yaml I disabled nix with

    nix:
        enable: false
    

    and stack new helloworld worked

  3. Next, I did,

    cd helloworld
    stack build
    

    The last command returned the error:

    I don't know how to install GHC on your system configuration, please install manually
    
  4. Thus, in ~/.stack/config.yaml I re-enabled nix :

    nix:
      enable: true
    

    With that, stack build did work… :thinking: :laughing:

  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.