diff options
Diffstat (limited to 'pkgs/development/tools/haskell/ihaskell/wrapper.nix')
-rw-r--r-- | pkgs/development/tools/haskell/ihaskell/wrapper.nix | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/pkgs/development/tools/haskell/ihaskell/wrapper.nix b/pkgs/development/tools/haskell/ihaskell/wrapper.nix index b20f8fa4f50..035ad738a82 100644 --- a/pkgs/development/tools/haskell/ihaskell/wrapper.nix +++ b/pkgs/development/tools/haskell/ihaskell/wrapper.nix @@ -1,36 +1,23 @@ -{ stdenv, makeWrapper, ihaskell, ipython, ghc }: - -stdenv.mkDerivation rec { - - inherit (ihaskell) name pname src version meta; - - buildInputs = [ makeWrapper ]; - - preferLocalBuild = true; - - buildCommand = let profile = "${pname}-${version}/profile/profile.tar"; in '' - tar xf $src ${profile} - mkdir -p $out/share/`dirname ${profile}` - mkdir profile - cd profile - tar xf ../${profile} - for cfg in ipython_*config.py;do - sed -i -e "1iexe = '${ihaskell}/bin/IHaskell'" $cfg - done - tar cf $out/share/${profile} . - makeWrapper "${ihaskell}/bin/IHaskell" "$out/bin/ihaskell" \ - --prefix PATH : "${ghc}/bin:${ihaskell}/bin:${ipython}/bin" \ - --prefix LD_LIBRARY_PATH : "${ihaskell}/lib/ghc-${ghc.version}/${name}/" \ - --add-flags "--ipython=${ipython}/bin/ipython" \ - --set PROFILE_DIR "\$HOME/.ipython/profile_haskell" \ - --set PROFILE_TAR "$out/share/${profile}" \ - --set PROFILE_INIT "\$([ ! -d \$PROFILE_DIR ] \ - && mkdir -p \$PROFILE_DIR \ - && tar xf \$PROFILE_TAR -C \$PROFILE_DIR \ - ; [ -d \$PROFILE_DIR ] && for cfg in \$PROFILE_DIR/ipython_*config.py;do \ - sed -i -e '/.*exe.*IHaskell.*/d' \$cfg; sed -i -e \"1iexe = '${ihaskell}/bin/IHaskell'\" \$cfg;done ) \ - " \ - --prefix GHC_PACKAGE_PATH : "\$(${ghc.GHCGetPackages} ${ghc.version}|sed -e 's, -package-db ,:,g'|cut -b 2-):${ihaskell}/lib/ghc-${ghc.version}/package.conf.d/${pname}-${version}.installedconf" \ - --set GHC_PACKAGE_PATH "\$GHC_PACKAGE_PATH:" # always end with : to include base packages +{ 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/. ''; } |