diff options
author | Charles Strahan <charles.c.strahan@gmail.com> | 2016-01-31 23:00:43 -0500 |
---|---|---|
committer | Charles Strahan <charles.c.strahan@gmail.com> | 2016-01-31 23:00:43 -0500 |
commit | 1a2d7c679a0db139e9a584acaa71e61fbad386e3 (patch) | |
tree | e470fa4a440a28f1b23f1cbb4b60b43305fb584c /pkgs/development/haskell-modules/hoogle.nix | |
parent | 05b2afed331dc8f8d7a2c21a31b34bbd6c7c8807 (diff) | |
download | nixpkgs-1a2d7c679a0db139e9a584acaa71e61fbad386e3.tar nixpkgs-1a2d7c679a0db139e9a584acaa71e61fbad386e3.tar.gz nixpkgs-1a2d7c679a0db139e9a584acaa71e61fbad386e3.tar.bz2 nixpkgs-1a2d7c679a0db139e9a584acaa71e61fbad386e3.tar.lz nixpkgs-1a2d7c679a0db139e9a584acaa71e61fbad386e3.tar.xz nixpkgs-1a2d7c679a0db139e9a584acaa71e61fbad386e3.tar.zst nixpkgs-1a2d7c679a0db139e9a584acaa71e61fbad386e3.zip |
ghcWithHoogle: add support for ghcjs
Diffstat (limited to 'pkgs/development/haskell-modules/hoogle.nix')
-rw-r--r-- | pkgs/development/haskell-modules/hoogle.nix | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/pkgs/development/haskell-modules/hoogle.nix b/pkgs/development/haskell-modules/hoogle.nix index 14464ceca80..b805195bc92 100644 --- a/pkgs/development/haskell-modules/hoogle.nix +++ b/pkgs/development/haskell-modules/hoogle.nix @@ -23,13 +23,33 @@ # 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, rehoo +{ lib, stdenv, hoogle, rehoo, writeText , ghc, packages ? [ ghc.ghc ] }: let inherit (stdenv.lib) optional; wrapper = ./hoogle-local-wrapper.sh; + isGhcjs = ghc.isGhcjs or false; + haddockExe = + if !isGhcjs + then "haddock" + else "haddock-ghcjs"; + ghcName = + if !isGhcjs + then "ghc" + else "ghcjs"; + docLibGlob = + if !isGhcjs + then ''share/doc/ghc*/html/libraries'' + else ''doc/lib''; + # On GHCJS, use a stripped down version of GHC's prologue.txt + prologue = + if !isGhcjs + then "${ghc}/${docLibGlob}/prologue.txt" + else writeText "ghcjs-prologue.txt" '' + This index includes documentation for many Haskell modules. + ''; in stdenv.mkDerivation { name = "hoogle-local-0.1"; @@ -58,7 +78,7 @@ stdenv.mkDerivation { } echo importing builtin packages - for docdir in ${ghc}/share/doc/ghc*/html/libraries/*; do + for docdir in ${ghc}/${docLibGlob}/*; do if [[ -d $docdir ]]; then import_dbs $docdir ln -sfn $docdir $out/share/doc/hoogle @@ -68,7 +88,7 @@ stdenv.mkDerivation { echo importing other packages for i in $docPackages; do if [[ ! $i == $out ]]; then - for docdir in $i/share/doc/*-ghc-*/* $i/share/doc/*; do + for docdir in $i/share/doc/*-${ghcName}-*/* $i/share/doc/*; do name=`basename $docdir` docdir=$docdir/html if [[ -d $docdir ]]; then @@ -99,9 +119,9 @@ stdenv.mkDerivation { args="$args --read-interface=$name_version,$hdfile" done - ${ghc}/bin/haddock --gen-index --gen-contents -o . \ + ${ghc}/bin/${haddockExe} --gen-index --gen-contents -o . \ -t "Haskell Hierarchical Libraries" \ - -p ${ghc}/share/doc/ghc*/html/libraries/prologue.txt \ + -p ${prologue} \ $args echo finishing up |