Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 12ee278a0d5f
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1682353805e3
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 9, 2018

  1. generic-stack-builder: also support nix-build

    We need to add the STACK_IN_NIX_EXTRA_ARGS hook in configurePhase also to ensure we get the right args when calling ```nix-build``` (as opposed to nix-shell).
    matthewbauer authored May 9, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1682353 View commit details
Showing with 14 additions and 9 deletions.
  1. +14 −9 pkgs/development/haskell-modules/generic-stack-builder.nix
23 changes: 14 additions & 9 deletions pkgs/development/haskell-modules/generic-stack-builder.nix
Original file line number Diff line number Diff line change
@@ -11,6 +11,18 @@ with stdenv.lib;
}@args:

let stackCmd = "stack --internal-re-exec-version=${stack.version}";

# Add all dependencies in buildInputs including propagated ones to
# STACK_IN_NIX_EXTRA_ARGS.
addStackArgsHook = ''
for pkg in ''${pkgsHostHost[@]} ''${pkgsHostBuild[@]} ''${pkgsHostTarget[@]}
do
[ -d "$pkg/lib" ] && \
export STACK_IN_NIX_EXTRA_ARGS+=" --extra-lib-dirs=$pkg/lib"
[ -d "$pkg/include" ] && \
export STACK_IN_NIX_EXTRA_ARGS+=" --extra-include-dirs=$pkg/include"
done
'';
in stdenv.mkDerivation (args // {

buildInputs =
@@ -21,15 +33,7 @@ in stdenv.mkDerivation (args // {
STACK_PLATFORM_VARIANT="nix";
STACK_IN_NIX_SHELL=1;
STACK_IN_NIX_EXTRA_ARGS = extraArgs;
shellHook = ''
for pkg in ''${pkgsHostHost[@]} ''${pkgsHostBuild[@]} ''${pkgsHostTarget[@]}
do
[ -d "$pkg/lib" ] && \
export STACK_IN_NIX_EXTRA_ARGS+=" --extra-lib-dirs=$pkg/lib"
[ -d "$pkg/include" ] && \
export STACK_IN_NIX_EXTRA_ARGS+=" --extra-include-dirs=$pkg/include"
done
'';
shellHook = addStackArgsHook;


# XXX: workaround for https://ghc.haskell.org/trac/ghc/ticket/11042.
@@ -46,6 +50,7 @@ in stdenv.mkDerivation (args // {

configurePhase = args.configurePhase or ''
export STACK_ROOT=$NIX_BUILD_TOP/.stack
${addStackArgsHook}
'';

buildPhase = args.buildPhase or "${stackCmd} build";