summary refs log tree commit diff
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2016-11-21 20:44:42 +0100
committerProfpatsch <mail@profpatsch.de>2016-11-24 12:31:58 +0100
commitb8a69aaba97f8abdd0de735ac84d6da6e91ab165 (patch)
treef56d9c6888c333076c934d76501c2e25151bd507
parent0c6b3a3647fdc604ebfcce7091103d6deb0e9fc9 (diff)
downloadnixlib-b8a69aaba97f8abdd0de735ac84d6da6e91ab165.tar
nixlib-b8a69aaba97f8abdd0de735ac84d6da6e91ab165.tar.gz
nixlib-b8a69aaba97f8abdd0de735ac84d6da6e91ab165.tar.bz2
nixlib-b8a69aaba97f8abdd0de735ac84d6da6e91ab165.tar.lz
nixlib-b8a69aaba97f8abdd0de735ac84d6da6e91ab165.tar.xz
nixlib-b8a69aaba97f8abdd0de735ac84d6da6e91ab165.tar.zst
nixlib-b8a69aaba97f8abdd0de735ac84d6da6e91ab165.zip
haskell/hoogle.nix: make an empty packages list possible
Building hoogle environments with an empty list of packages threw a built-time
error. This was particularly confusing when giving e.g. `(hps: [hps.Cabal])`
which, since `Cabal` is set to `null` (because it’s a distribution package),
would have lead to the same error as an empty list.

It was not useful to throw an error at all, because sometimes one only wants to
build an environment for the distribution packages; also the default value for
packages wasn’t even a valid value, so it is removed.
-rw-r--r--pkgs/development/haskell-modules/hoogle.nix14
1 files changed, 6 insertions, 8 deletions
diff --git a/pkgs/development/haskell-modules/hoogle.nix b/pkgs/development/haskell-modules/hoogle.nix
index bf7fd18f820a..a0b909628297 100644
--- a/pkgs/development/haskell-modules/hoogle.nix
+++ b/pkgs/development/haskell-modules/hoogle.nix
@@ -23,8 +23,8 @@
 # This will build mmorph and monadControl, and have the hoogle installation
 # refer to their documentation via symlink so they are not garbage collected.
 
-{ lib, stdenv, hoogle, writeText
-, ghc, packages ? [ ghc.ghc ]
+{ lib, stdenv, hoogle, writeText, ghc
+, packages
 }:
 
 let
@@ -51,6 +51,9 @@ let
     else writeText "ghcjs-prologue.txt" ''
       This index includes documentation for many Haskell modules.
     '';
+
+  docPackages = lib.closePropagation packages;
+
 in
 stdenv.mkDerivation {
   name = "hoogle-local-0.1";
@@ -58,14 +61,9 @@ stdenv.mkDerivation {
 
   phases = [ "buildPhase" ];
 
-  docPackages = (lib.closePropagation packages);
+  inherit docPackages;
 
   buildPhase = ''
-    if [ -z "$docPackages" ]; then
-        echo "ERROR: The packages attribute has not been set"
-        exit 1
-    fi
-
     mkdir -p $out/share/doc/hoogle
 
     echo importing builtin packages