Commit b0b5236d authored by Renato Alves's avatar Renato Alves Committed by Vaibhav Sagar

Build 'jupyter console' wrappers with nix installation

parent f9727588
......@@ -98,11 +98,11 @@ let
};
ihaskellEnv = haskellPackages.ghcWithPackages (self: [ self.ihaskell ] ++ packages self);
jupyter = nixpkgs.python3.withPackages (ps: [ ps.jupyter ps.notebook ]);
ihaskellSh = cmd: nixpkgs.writeScriptBin "ihaskell-${cmd}" ''
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 jupyter ] ++ systemPackages nixpkgs)}"
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) --use-rtsopts="${rtsopts}" && ${jupyter}/bin/jupyter ${cmd} "$@"
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) --use-rtsopts="${rtsopts}" && ${jupyter}/bin/jupyter ${cmd} ${extraArgs} "$@"
'';
in
nixpkgs.buildEnv {
......@@ -110,8 +110,9 @@ nixpkgs.buildEnv {
buildInputs = [ nixpkgs.makeWrapper ];
paths = [ ihaskellEnv jupyter ];
postBuild = ''
ln -s ${ihaskellSh "notebook"}/bin/ihaskell-notebook $out/bin/
ln -s ${ihaskellSh "nbconvert"}/bin/ihaskell-nbconvert $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 ${jupyter}/lib/*/site-packages)"
......
......@@ -65,11 +65,11 @@ let
};
ihaskellEnv = haskellPackages.ghcWithPackages (self: [ self.ihaskell ] ++ packages self);
jupyter = nixpkgs.python3.withPackages (ps: [ ps.jupyter ps.notebook ]);
ihaskellSh = cmd: nixpkgs.writeScriptBin "ihaskell-${cmd}" ''
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 jupyter ] ++ systemPackages nixpkgs)}"
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) --use-rtsopts="${rtsopts}" && ${jupyter}/bin/jupyter ${cmd} "$@"
${ihaskellEnv}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) --use-rtsopts="${rtsopts}" && ${jupyter}/bin/jupyter ${cmd} ${extraArgs} "$@"
'';
in
nixpkgs.buildEnv {
......@@ -77,8 +77,9 @@ nixpkgs.buildEnv {
buildInputs = [ nixpkgs.makeWrapper ];
paths = [ ihaskellEnv jupyter ];
postBuild = ''
ln -s ${ihaskellSh "notebook"}/bin/ihaskell-notebook $out/bin/
ln -s ${ihaskellSh "nbconvert"}/bin/ihaskell-nbconvert $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 ${jupyter}/lib/*/site-packages)"
......
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