📄️ Overriding dependencies
Haskell libraries ultimately come from Hackage, and nixpkgs] contains [most of these. Adding a library to your project involves modifying the .cabal file and restarting the nix shell. The process is typically as follows:
📄️ DevShell
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.
📄️ Project modules
haskell-flake's per-project configuration can be modularized and shared among multiple repos. This is done using the flake.haskellFlakeProjectModules flake output.
📄️ Creating package sets
While haskell-flake is generally used to develop and build individual Haskell projects, you can also use it to create a custom Haskell package set that you can use in other projects. This is useful if you want to create a common package set to be shared across multiple projects.
📄️ Optimize package size
Haskell package derivations created by haskell-flake are shipped with symlinks to other store paths, like $out/lib, $out/nix-support and $out/share/doc. In addition, enabling profiling or haddock can increase the size of these packages. If your Haskell application is end-user software, you will want to strip all but the executables. This can be achieved using justStaticExecutables: