2015-09-28 21:25:51 +02:00
|
|
|
{ stdenv, writeScriptBin, makeWrapper, buildEnv, ghcWithPackages, ihaskell, ipython, packages }:
|
2015-04-11 00:09:31 +02:00
|
|
|
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" ''
|
2015-06-12 10:50:40 +02:00
|
|
|
#! ${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
|
|
|
|
'';
|
2015-04-11 00:09:31 +02:00
|
|
|
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 = ''
|
2015-09-28 21:25:51 +02:00
|
|
|
. "${makeWrapper}/nix-support/setup-hook"
|
2015-04-15 22:59:07 +02:00
|
|
|
ln -s ${ihaskellSh}/bin/ihaskell-notebook $out/bin/.
|
2015-09-28 21:25:51 +02:00
|
|
|
for prg in $out/bin"/"*;do
|
|
|
|
wrapProgram $prg --set PYTHONPATH "$(echo ${ipython}/lib/*/site-packages)"
|
|
|
|
done
|
2015-04-15 22:59:07 +02:00
|
|
|
'';
|
|
|
|
}
|