{ ghc, nixpkgs ? import <nixpkgs> }:

let
  snapshot = "lts-10.5";
  stackage = import (fetchTarball {
    url = "https://stackage.serokell.io/drczwlyf6mi0ilh3kgv01wxwjfgvq14b-stackage/default.nix.tar.gz";
    sha256 = "1bwlbxx6np0jfl6z9gkmmcq22crm0pa07a8zrwhz5gkal64y6jpz";
  });
  inherit (nixpkgs { overlays = [ stackage."${snapshot}" ]; }) haskell pkgs;

  haskellPackages = pkgs.haskell.packages."${snapshot}";
in haskell.lib.buildStackProject {
  inherit ghc;
  name = "stackenv";
  buildInputs = (with pkgs;
    [ postgresql zlib libsodium
    ]) ++ (with haskellPackages;
    [ yesod-bin
    ]);
}
