1{ stdenv, ghc, pkgconfig, glibcLocales }:
2
3with stdenv.lib;
4
5{ buildInputs ? []
6, extraArgs ? []
7, LD_LIBRARY_PATH ? ""
8, ...
9}@args:
10
11stdenv.mkDerivation (args // {
12
13 buildInputs =
14 buildInputs ++
15 optional stdenv.isLinux glibcLocales ++
16 [ ghc pkgconfig ];
17
18 STACK_IN_NIX_SHELL=1;
19 STACK_IN_NIX_EXTRA_ARGS =
20 concatMap (pkg: ["--extra-lib-dirs=${pkg}/lib"
21 "--extra-include-dirs=${pkg}/include"]) buildInputs ++
22 extraArgs;
23
24 # XXX: workaround for https://ghc.haskell.org/trac/ghc/ticket/11042.
25 LD_LIBRARY_PATH = "${makeLibraryPath buildInputs}:${LD_LIBRARY_PATH}";
26
27 preferLocalBuild = true;
28
29 configurePhase = args.configurePhase or "stack setup";
30
31 buildPhase = args.buildPhase or "stack build";
32
33 checkPhase = args.checkPhase or "stack test";
34
35 doCheck = args.doCheck or true;
36
37 installPhase = args.installPhase or ''
38 stack --local-bin-path=$out/bin build --copy-bins
39 '';
40})