haskell-flake uses the shellFor function to provide a Haskell development shell. shellFor in turn uses the standard mkShell function to create a Nix shell environment. The mkShellArgs option can be used to pass custom arguments to mkShell.

  haskellProjects.default = {
    devShell = {
      mkShellArgs = {
        shellHook = ''
          export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.flint}/lib

Composing devShells

While mkShellArgs is a convenient way to extend the Haskell devShell, sometimes you want to compose multiple devShell environments in a way you want.

The devShell of a haskell-flake project is exposed in the config.haskellProjects.<name>.outputs.devShell attribute. You can pass this devShell to the inputsFrom argument of a mkShell function in order to include the Haskell devShell in another devShell. The same technique can be used to compose devShells created by other flake-parts modules.

For example, in haskell-template, we create a top-level devShell that merges the devShell of the haskell-flake project, the devShell of mission-control and the devShell of flake-root as follows::

  devShell = pkgs.mkShell {
    inputsFrom = [

This sort of composition is either impossible or very complex to do with the mkShellArgs approach.

Links to this page