nixpkgs/pkgs/development/tools/haskell/ihaskell/wrapper.nix
2015-04-15 23:00:03 +02:00

24 lines
864 B
Nix

{ stdenv, writeScriptBin, buildEnv, ghcWithPackages, ihaskell, ipython, packages }:
let
ihaskellEnv = ghcWithPackages (self: [
self.ihaskell
self.ihaskell-blaze
self.ihaskell-diagrams
self.ihaskell-display
] ++ packages self);
ihaskellSh = writeScriptBin "ihaskell-notebook" ''
#!/bin/sh
export GHC_PACKAGE_PATH="$(echo ${ihaskellEnv}/lib/*/package.conf.d| tr ' ' ':'):$GHC_PACKAGE_PATH"
export PATH="${ihaskell}/bin:${ihaskellEnv}/bin:${ipython}/bin"
${ihaskell}/bin/ihaskell install -l $(${ihaskellEnv}/bin/ghc --print-libdir) && ${ipython}/bin/ipython notebook --kernel=haskell
'';
profile = "${ihaskell.pname}-${ihaskell.version}/profile/profile.tar";
in
buildEnv {
name = "ihaskell-with-packages";
paths = [ ihaskellEnv ipython ];
postBuild = ''
ln -s ${ihaskellSh}/bin/ihaskell-notebook $out/bin/.
'';
}