Fix buildStackProject in nix-build

This commit is contained in:
Will Fancher 2017-10-03 22:39:33 -04:00 committed by Domen Kožar
parent a7d25d4bbc
commit daf78689d4

View file

@ -1,4 +1,4 @@
{ stdenv, ghc, pkgconfig, glibcLocales, cacert }@depArgs:
{ stdenv, ghc, pkgconfig, glibcLocales, cacert, stack }@depArgs:
with stdenv.lib;
@ -6,15 +6,17 @@ with stdenv.lib;
, extraArgs ? []
, LD_LIBRARY_PATH ? []
, ghc ? depArgs.ghc
, stack ? depArgs.stack
, ...
}@args:
stdenv.mkDerivation (args // {
let stackCmd = "stack --internal-re-exec-version=${stack.version}";
in stdenv.mkDerivation (args // {
buildInputs =
buildInputs ++
optional stdenv.isLinux glibcLocales ++
[ ghc pkgconfig ];
[ ghc pkgconfig stack ];
STACK_PLATFORM_VARIANT="nix";
STACK_IN_NIX_SHELL=1;
@ -39,13 +41,13 @@ stdenv.mkDerivation (args // {
export STACK_ROOT=$NIX_BUILD_TOP/.stack
'';
buildPhase = args.buildPhase or "stack build";
buildPhase = args.buildPhase or "${stackCmd} build";
checkPhase = args.checkPhase or "stack test";
checkPhase = args.checkPhase or "${stackCmd} test";
doCheck = args.doCheck or true;
installPhase = args.installPhase or ''
stack --local-bin-path=$out/bin build --copy-bins
${stackCmd} --local-bin-path=$out/bin build --copy-bins
'';
})