Commit a87ea7b0 authored by Alexander Vershilov's avatar Alexander Vershilov

Move to jupyter-lab.

Moves package from using jupyter-notebook to the jupyter-lab.
Both backends can still be used using: ihaskell-notebook and
ihaskell-lab respectively.
parent bf631b91
......@@ -49,25 +49,26 @@ let
zeromq4-haskell = nixpkgs.haskell.lib.dontCheck super.zeromq4-haskell;
} // displays self);
ihaskellEnv = haskellPackages.ghcWithPackages (self: [ self.ihaskell ] ++ packages self);
notebook = nixpkgs.python3.withPackages (ps: [ ps.notebook ] ++ pythonPackages ps);
jupyterlab = nixpkgs.python3.withPackages (ps: [ ps.jupyterlab ] ++ pythonPackages ps);
ihaskellSh = cmd: extraArgs: nixpkgs.writeScriptBin "ihaskell-${cmd}" ''
#! ${nixpkgs.stdenv.shell}
export GHC_PACKAGE_PATH="$(echo ${ihaskellEnv}/lib/*/package.conf.d| tr ' ' ':'):$GHC_PACKAGE_PATH"
export PATH="${nixpkgs.stdenv.lib.makeBinPath ([ ihaskellEnv notebook ] ++ systemPackages nixpkgs)}:$PATH"
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) --use-rtsopts="${rtsopts}" && ${notebook}/bin/jupyter ${cmd} ${extraArgs} "$@"
export PATH="${nixpkgs.stdenv.lib.makeBinPath ([ ihaskellEnv jupyterlab ] ++ systemPackages nixpkgs)}:$PATH"
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) --use-rtsopts="${rtsopts}" && ${jupyterlab}/bin/jupyter ${cmd} ${extraArgs} "$@"
'';
in
nixpkgs.buildEnv {
name = "ihaskell-with-packages";
buildInputs = [ nixpkgs.makeWrapper ];
paths = [ ihaskellEnv notebook ];
paths = [ ihaskellEnv jupyterlab ];
postBuild = ''
ln -s ${ihaskellSh "lab" ""}/bin/ihaskell-lab $out/bin/
ln -s ${ihaskellSh "notebook" ""}/bin/ihaskell-notebook $out/bin/
ln -s ${ihaskellSh "nbconvert" ""}/bin/ihaskell-nbconvert $out/bin/
ln -s ${ihaskellSh "console" "--kernel=haskell"}/bin/ihaskell-console $out/bin/
for prg in $out/bin"/"*;do
if [[ -f $prg && -x $prg ]]; then
wrapProgram $prg --set PYTHONPATH "$(echo ${notebook}/lib/*/site-packages)"
wrapProgram $prg --set PYTHONPATH "$(echo ${jupyterlab}/lib/*/site-packages)"
fi
done
'';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment