From daf78689d475d6e3355e4c47e9314208d877960d Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Tue, 3 Oct 2017 22:39:33 -0400 Subject: [PATCH] Fix buildStackProject in nix-build --- .../haskell-modules/generic-stack-builder.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-stack-builder.nix b/pkgs/development/haskell-modules/generic-stack-builder.nix index 7fbca53886ef..6e43df9aba69 100644 --- a/pkgs/development/haskell-modules/generic-stack-builder.nix +++ b/pkgs/development/haskell-modules/generic-stack-builder.nix @@ -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 ''; })