2017-11-08 15:09:18 +00:00
|
|
|
{ stdenv, writeScriptBin, makeWrapper, buildEnv, haskell, ghcWithPackages, jupyter, packages }:
|
2015-04-10 23:09:31 +01:00
|
|
|
let
|
|
|
|
ihaskellEnv = ghcWithPackages (self: [
|
|
|
|
self.ihaskell
|
2017-11-06 06:29:56 +00:00
|
|
|
(haskell.lib.doJailbreak self.ihaskell-blaze)
|
|
|
|
(haskell.lib.doJailbreak self.ihaskell-diagrams)
|
|
|
|
(haskell.lib.doJailbreak self.ihaskell-display)
|
2015-04-10 23:09:31 +01:00
|
|
|
] ++ packages self);
|
2015-04-15 21:59:07 +01:00
|
|
|
ihaskellSh = writeScriptBin "ihaskell-notebook" ''
|
2015-06-12 09:50:40 +01:00
|
|
|
#! ${stdenv.shell}
|
2015-04-15 21:59:07 +01:00
|
|
|
export GHC_PACKAGE_PATH="$(echo ${ihaskellEnv}/lib/*/package.conf.d| tr ' ' ':'):$GHC_PACKAGE_PATH"
|
2018-06-08 15:32:53 +01:00
|
|
|
export PATH="${stdenv.lib.makeBinPath ([ ihaskellEnv jupyter ])}\${PATH:+':'}$PATH"
|
2017-11-08 15:09:18 +00:00
|
|
|
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) && ${jupyter}/bin/jupyter notebook
|
2015-04-15 21:59:07 +01:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
buildEnv {
|
|
|
|
name = "ihaskell-with-packages";
|
2017-11-06 06:29:56 +00:00
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
paths = [ ihaskellEnv jupyter ];
|
2015-04-15 21:59:07 +01:00
|
|
|
postBuild = ''
|
2017-11-06 06:29:56 +00:00
|
|
|
ln -s ${ihaskellSh}/bin/ihaskell-notebook $out/bin/
|
2015-09-28 20:25:51 +01:00
|
|
|
for prg in $out/bin"/"*;do
|
2017-11-06 06:29:56 +00:00
|
|
|
if [[ -f $prg && -x $prg ]]; then
|
|
|
|
wrapProgram $prg --set PYTHONPATH "$(echo ${jupyter}/lib/*/site-packages)"
|
|
|
|
fi
|
2015-09-28 20:25:51 +01:00
|
|
|
done
|
2015-04-15 21:59:07 +01:00
|
|
|
'';
|
|
|
|
}
|