stack new servant-boilerplate servant
cabal2nix . > servant-boilerplate.nix
pullout required packages from cabal file
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc865" }:
let
inherit (nixpkgs) pkgs;
#final01 = import ./default.nix {};
ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [
aeson base servant-server wai warp
]);
systemPackages = with pkgs; [
# add whatever system packages you want.
binutils
gcc
ghc
zlib
zlib.dev
];
in
pkgs.stdenv.mkDerivation {
name = "servant-boilerplate";
buildInputs = [ ghc systemPackages ];
shellHook = ''
eval $(egrep ^export ${ghc}/bin/ghc)
'';
}
nix:
enable: true
shell-file: shell.nix
nix-shell
stack install
stack exec -- servant-boilerplate-exe
curl http://localhost:8080/users --header "accept: application/json"