Nix recipes for Haskellers

I’m finalizing my short tutorial on Nix for Haskell programmers. If you are a Haskell programmer, and if you feel like something could be explained in this tutorial, please let me know!


Nice! Some comments how to improve further:

  • inline shebang snippet
  • haskell.nix for more complicated setups

Thanks! I’ve improved in the article taking your two comments.

1 Like

Thanks for this work ! I’m struggling with stack thus I would be interested to read more about how it relates to Nix. However it may not be part of the topic you want to cover…

Have you tried adding a default.nix (as the article suggests here) to your exercism exercise project, and used exclusively Nix (no stack) to build it?


  1. Add default.nix using the snippet in the article
  2. Run nix-shell --run ghcid

(ghcid will recompile as you edit the sources)

If you use ghcid -T main it will even run it.

I will try it, thanks.

nix-shell --run ghcid outputs same error as with stack

stm        > /run/user/1000/stack-7a9824c190b5454b/stm- error: Not in scope: ‘always’
stm        >    |
stm        > 34 |         always,
stm        >    |         ^^^^^^
stm        > 
stm        > /run/user/1000/stack-7a9824c190b5454b/stm- error: Not in scope: ‘alwaysSucceeds’
stm        >    |
stm        > 35 |         alwaysSucceeds,
stm        >    |         ^^^^^^^^^^^^^^

--  While building package stm- 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- build --ghc-options ""
    Process exited with code: ExitFailure 1

This seems like an error with the cabal configuration of the project, doesn’t it ? (I am a newbie with cabal and stack).