2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, writeScriptBin, makeWrapper, buildEnv, haskell, ghcWithPackages, jupyter, packages }:
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
|
|
|
ihaskellEnv = ghcWithPackages (self: [
|
|
|
|
self.ihaskell
|
2021-05-20 23:08:51 +00:00
|
|
|
self.ihaskell-blaze
|
2022-10-30 15:09:59 +00:00
|
|
|
# Doesn't work with latest ihaskell versions missing an unrelated change
|
|
|
|
# https://github.com/IHaskell/IHaskell/issues/1378
|
|
|
|
# self.ihaskell-diagrams
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ packages self);
|
|
|
|
ihaskellSh = writeScriptBin "ihaskell-notebook" ''
|
|
|
|
#! ${stdenv.shell}
|
|
|
|
export GHC_PACKAGE_PATH="$(echo ${ihaskellEnv}/lib/*/package.conf.d| tr ' ' ':'):$GHC_PACKAGE_PATH"
|
2021-02-05 17:12:51 +00:00
|
|
|
export PATH="${lib.makeBinPath ([ ihaskellEnv jupyter ])}''${PATH:+:}$PATH"
|
2020-04-24 23:36:52 +00:00
|
|
|
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) && ${jupyter}/bin/jupyter notebook
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
buildEnv {
|
|
|
|
name = "ihaskell-with-packages";
|
2022-09-09 14:08:57 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
paths = [ ihaskellEnv jupyter ];
|
|
|
|
postBuild = ''
|
|
|
|
ln -s ${ihaskellSh}/bin/ihaskell-notebook $out/bin/
|
|
|
|
for prg in $out/bin"/"*;do
|
|
|
|
if [[ -f $prg && -x $prg ]]; then
|
|
|
|
wrapProgram $prg --set PYTHONPATH "$(echo ${jupyter}/lib/*/site-packages)"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
}
|