By default this will mean that Stack will use Nix to download non-Haskell dependencies. E.g. GHC and external C libraries will be downloaded by Nix.
This allows you to pin all dependencies that you have, including the compiler and external libraries (make sure to pin a specific version of nixpkgs though). And it will give developers a reproducible build environment.
It is also possible to take this Nix integration even further and make Stack download all Haskell dependencies from Nix as well. However, this requires to write a custom `stack-shell.nix` file, so I would only recommend this for people who are already familiar with Nix.
This file must then be configured in `stack.yml`
Example `stack.yml`:
# Using a `ghc-*` resolver means that stack won't try to download and build any packages itself,
# instead it will only use the packages that are shipped with the compiler.
# In `./nix/stack-shell.nix`, we ensure that the compiler indeed ships all the packages we
# need.
resolver: ghc-9.0
packages:
- "."
# This makes stack pick up our nix environment for building by default.
nix:
enable: true
shell-file: nix/stack-shell.nix
path: ["nixpkgs=./nix/nixpkgs-pinned.nix"]
By default this will mean that Stack will use Nix to download non-Haskell dependencies. E.g. GHC and external C libraries will be downloaded by Nix.
This allows you to pin all dependencies that you have, including the compiler and external libraries (make sure to pin a specific version of nixpkgs though). And it will give developers a reproducible build environment.
It is also possible to take this Nix integration even further and make Stack download all Haskell dependencies from Nix as well. However, this requires to write a custom `stack-shell.nix` file, so I would only recommend this for people who are already familiar with Nix. This file must then be configured in `stack.yml`
Example `stack.yml`:
# Using a `ghc-*` resolver means that stack won't try to download and build any packages itself, # instead it will only use the packages that are shipped with the compiler. # In `./nix/stack-shell.nix`, we ensure that the compiler indeed ships all the packages we # need. resolver: ghc-9.0
packages: - "."
# This makes stack pick up our nix environment for building by default. nix: enable: true shell-file: nix/stack-shell.nix path: ["nixpkgs=./nix/nixpkgs-pinned.nix"]