From 292a8892a091905500105be931d8ddb4bc3cd68c Mon Sep 17 00:00:00 2001 From: Mathieu Boespflug Date: Sun, 5 Jun 2016 00:19:06 +0200 Subject: [PATCH 1/4] haskell.lib.buildStackProject: allow passing in a custom GHC version. Previously, the user could only compile using the default version of GHC in Nixpkgs. Now this can be changed by setting the `ghc` attribute appropriately. --- pkgs/development/haskell-modules/generic-stack-builder.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/haskell-modules/generic-stack-builder.nix b/pkgs/development/haskell-modules/generic-stack-builder.nix index 94999ed8c45a..caada71632d5 100644 --- a/pkgs/development/haskell-modules/generic-stack-builder.nix +++ b/pkgs/development/haskell-modules/generic-stack-builder.nix @@ -5,6 +5,7 @@ with stdenv.lib; { buildInputs ? [] , extraArgs ? [] , LD_LIBRARY_PATH ? "" +, ghc ? ghc , ... }@args: From e6aa4e0ccb6b169eaa4ff5ff28f332e078c018b4 Mon Sep 17 00:00:00 2001 From: Mathieu Boespflug Date: Sun, 5 Jun 2016 00:30:37 +0200 Subject: [PATCH 2/4] doc: Document how to set custom GHC version in haskell.lib.buildStackProject. --- doc/languages-frameworks/haskell.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/languages-frameworks/haskell.md b/doc/languages-frameworks/haskell.md index e066ad110bec..cdabcbe0379d 100644 --- a/doc/languages-frameworks/haskell.md +++ b/doc/languages-frameworks/haskell.md @@ -378,6 +378,23 @@ special options turned on: buildInputs = [ R zeromq zlib ]; } +You can select a particular GHC version to compile with by setting the +`ghc` attribute as an argument to `buildStackProject`. Better yet, let +Stack choose what GHC version it wants based on the snapshot specified +in `stack.yaml` (only works with Stack >= 1.1.3): + + {nixpkgs ? import { }, ghc ? nixpkgs.ghc} + + with nixpkgs; + + let R = pkgs.R.override { enableStrictBarrier = true; }; + in + haskell.lib.buildStackProject { + name = "HaskellR"; + buildInputs = [ R zeromq zlib ]; + inherit ghc; + } + [stack-nix-doc]: http://docs.haskellstack.org/en/stable/nix_integration.html ### How to create ad hoc environments for `nix-shell` From 70bc97b731c74beb95b3cb95939ed6b9ea02b9b8 Mon Sep 17 00:00:00 2001 From: Mathieu Boespflug Date: Mon, 13 Jun 2016 00:53:20 +0200 Subject: [PATCH 3/4] haskell.lib.buildStackProject: fix treatment of LD_LIBRARY_PATH. Don't make LD_LIBRARY_PATH pick up cwd when original string is empty, due to colon terminated search path. --- pkgs/development/haskell-modules/generic-stack-builder.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-stack-builder.nix b/pkgs/development/haskell-modules/generic-stack-builder.nix index caada71632d5..07421b1d14f8 100644 --- a/pkgs/development/haskell-modules/generic-stack-builder.nix +++ b/pkgs/development/haskell-modules/generic-stack-builder.nix @@ -4,7 +4,7 @@ with stdenv.lib; { buildInputs ? [] , extraArgs ? [] -, LD_LIBRARY_PATH ? "" +, LD_LIBRARY_PATH ? [] , ghc ? ghc , ... }@args: @@ -23,7 +23,7 @@ stdenv.mkDerivation (args // { extraArgs; # XXX: workaround for https://ghc.haskell.org/trac/ghc/ticket/11042. - LD_LIBRARY_PATH = "${makeLibraryPath buildInputs}:${LD_LIBRARY_PATH}"; + LD_LIBRARY_PATH = makeLibraryPath (LD_LIBRARY_PATH ++ buildInputs); preferLocalBuild = true; From 3adf86eed6fcfc1baaba46e3052863876f0a91f7 Mon Sep 17 00:00:00 2001 From: Mathieu Boespflug Date: Mon, 13 Jun 2016 11:42:50 +0200 Subject: [PATCH 4/4] doc(haskell): Remove pesky tabs in code snippets. --- doc/languages-frameworks/haskell.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/languages-frameworks/haskell.md b/doc/languages-frameworks/haskell.md index cdabcbe0379d..2ddec0d9aba4 100644 --- a/doc/languages-frameworks/haskell.md +++ b/doc/languages-frameworks/haskell.md @@ -389,10 +389,10 @@ in `stack.yaml` (only works with Stack >= 1.1.3): let R = pkgs.R.override { enableStrictBarrier = true; }; in - haskell.lib.buildStackProject { + haskell.lib.buildStackProject { name = "HaskellR"; - buildInputs = [ R zeromq zlib ]; - inherit ghc; + buildInputs = [ R zeromq zlib ]; + inherit ghc; } [stack-nix-doc]: http://docs.haskellstack.org/en/stable/nix_integration.html