add shell.nix for building servant (+ tutorial + cookbook, optionally)
This commit is contained in:
parent
e2314aa059
commit
c8dbcea5a2
3 changed files with 44 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -25,8 +25,6 @@ cabal.config
|
|||
*.hp
|
||||
Setup
|
||||
.stack-work
|
||||
shell.nix
|
||||
default.nix
|
||||
doc/_build
|
||||
doc/venv
|
||||
doc/tutorial/static/api.js
|
||||
|
|
23
nix/README.md
Normal file
23
nix/README.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
You can use the `shell.nix` from this directory
|
||||
to build the servant packages or even the tutorial
|
||||
or cookbook if you want to, optionally.
|
||||
|
||||
Just the servant packages:
|
||||
|
||||
``` sh
|
||||
$ nix-shell nix/shell.nix
|
||||
```
|
||||
|
||||
Everything needed for the tutorial and the
|
||||
cookbook too:
|
||||
|
||||
``` sh
|
||||
$ nix-shell nix/shell.nix --arg tutorial true
|
||||
```
|
||||
|
||||
The `shell.nix` file also supports specifying
|
||||
a particular ghc version, e.g:
|
||||
|
||||
``` sh
|
||||
$ nix-shell nix/shell.nix --argstr compiler ghcHEAD
|
||||
```
|
21
nix/shell.nix
Normal file
21
nix/shell.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ pkgs ? import <nixpkgs> {}
|
||||
, compiler ? "ghc821"
|
||||
, tutorial ? false
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
ghc = haskell.packages.${compiler}.ghcWithPackages (_: []);
|
||||
docstuffs = python3.withPackages (ps: with ps; [ recommonmark sphinx sphinx_rtd_theme ]);
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "servant-dev";
|
||||
buildInputs = [ ghc zlib ]
|
||||
++ (if tutorial then [docstuffs postgresql] else []);
|
||||
shellHook = ''
|
||||
eval $(grep export ${ghc}/bin/ghc)
|
||||
export LD_LIBRARY_PATH="${zlib}/lib";
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue