{ ghc, nixpkgs ? (import <nixpkgs> {}) }:

let
  inherit (nixpkgs) haskell pkgs;
  haskellPackages = if ghc.version == pkgs.haskellPackages.ghc.version then pkgs.haskellPackages else pkgs.haskell.packages."ghc${builtins.replaceStrings ["."] [""] ghc.version}";
in haskell.lib.buildStackProject {
  inherit ghc;
  name = "stackenv";
  buildInputs = (with pkgs;
    [ postgresql zlib libsodium
    ]) ++ (with haskellPackages;
    [ yesod-bin
    ]);
}
