nixpkgs/pkgs/development/tools/haskell/ihaskell/wrapper.nix

28 lines
1 KiB
Nix
Raw Normal View History

{ stdenv, writeScriptBin, makeWrapper, buildEnv, ghcWithPackages, ihaskell, ipython, packages }:
let
ihaskellEnv = ghcWithPackages (self: [
self.ihaskell
self.ihaskell-blaze
self.ihaskell-diagrams
self.ihaskell-display
] ++ packages self);
2015-04-15 22:59:07 +02:00
ihaskellSh = writeScriptBin "ihaskell-notebook" ''
#! ${stdenv.shell}
2015-04-15 22:59:07 +02:00
export GHC_PACKAGE_PATH="$(echo ${ihaskellEnv}/lib/*/package.conf.d| tr ' ' ':'):$GHC_PACKAGE_PATH"
2016-08-23 00:06:51 +02:00
export PATH="${stdenv.lib.makeBinPath [ ihaskell ihaskellEnv ipython ]}"
2015-04-15 22:59:07 +02:00
${ihaskell}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) && ${ipython}/bin/ipython notebook --kernel=haskell
'';
profile = "${ihaskell.pname}-${ihaskell.version}/profile/profile.tar";
2015-04-15 22:59:07 +02:00
in
buildEnv {
name = "ihaskell-with-packages";
paths = [ ihaskellEnv ipython ];
postBuild = ''
. "${makeWrapper}/nix-support/setup-hook"
2015-04-15 22:59:07 +02:00
ln -s ${ihaskellSh}/bin/ihaskell-notebook $out/bin/.
for prg in $out/bin"/"*;do
wrapProgram $prg --set PYTHONPATH "$(echo ${ipython}/lib/*/site-packages)"
done
2015-04-15 22:59:07 +02:00
'';
}