2021-01-23 12:26:19 +00:00
|
|
|
{ lib, stdenv, writeScriptBin, makeWrapper, buildEnv, haskell, ghcWithPackages, jupyter, packages }:
|
2015-04-10 22:09:31 +00: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 22:09:31 +00:00
|
|
|
] ++ packages self);
|
2015-04-15 20:59:07 +00:00
|
|
|
ihaskellSh = writeScriptBin "ihaskell-notebook" ''
|
2015-06-12 08:50:40 +00:00
|
|
|
#! ${stdenv.shell}
|
2015-04-15 20:59:07 +00:00
|
|
|
export GHC_PACKAGE_PATH="$(echo ${ihaskellEnv}/lib/*/package.conf.d| tr ' ' ':'):$GHC_PACKAGE_PATH"
|
2021-01-23 12:26:19 +00:00
|
|
|
export PATH="${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 20:59:07 +00:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
buildEnv {
|
|
|
|
name = "ihaskell-with-packages";
|
2017-11-06 06:29:56 +00:00
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
paths = [ ihaskellEnv jupyter ];
|
2015-04-15 20:59:07 +00:00
|
|
|
postBuild = ''
|
2017-11-06 06:29:56 +00:00
|
|
|
ln -s ${ihaskellSh}/bin/ihaskell-notebook $out/bin/
|
2015-09-28 19:25:51 +00: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 19:25:51 +00:00
|
|
|
done
|
2015-04-15 20:59:07 +00:00
|
|
|
'';
|
|
|
|
}
|