Nix recipes for Haskellers aims to get a beginner comfortable managing simple Haskell programs and projects using Nix.
Here's an example using nix-shell to get a redistributable Haskell script that you can run on any Nix system with `./my-script.hs`:
#!/usr/bin/env nix-shell #!nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (pkgs: [ pkgs.turtle ])" main = do # do stuff putStrLn "Hello world from a distributable Haskell script!"
IFD and Haskell
callCabal2nix, which is implicitly used for building Haskell projects, uses IFD.. This means that since IFD is disabled by default in certain nix commands, the following commands will be broken for Haskell projects whose flake output specifies multiple system attributes:
nix flake show
nix flake check