From 7814b1739bbc7418dfeb24403b399cdbe2cc7219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Mon, 2 Feb 2015 22:34:57 +0100 Subject: [PATCH] ihaskell-with-packages: add environment --- .../tools/haskell/ihaskell/ng-wrapper.nix | 35 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 6 ++++ 2 files changed, 41 insertions(+) create mode 100644 pkgs/development/tools/haskell/ihaskell/ng-wrapper.nix diff --git a/pkgs/development/tools/haskell/ihaskell/ng-wrapper.nix b/pkgs/development/tools/haskell/ihaskell/ng-wrapper.nix new file mode 100644 index 000000000000..4ce78c31fe2f --- /dev/null +++ b/pkgs/development/tools/haskell/ihaskell/ng-wrapper.nix @@ -0,0 +1,35 @@ +{ stdenv, buildEnv, ghcWithPackages, makeWrapper, ihaskell, ipython, packages }: +let + ihaskellEnv = ghcWithPackages (self: [ + self.ihaskell + self.ihaskell-blaze + self.ihaskell-diagrams + self.ihaskell-display + ] ++ packages self); + profile = "${ihaskell.pname}-${ihaskell.version}/profile/profile.tar"; + drv = buildEnv { + name = "ihaskell-with-packages"; + paths = [ ihaskellEnv ipython ]; + postBuild = '' + tar xf ${ihaskell.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} . + wrapProgram "$out/bin/IHaskell" \ + --prefix PATH : "${ihaskellEnv}/bin:${ipython}/bin" \ + --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 )" \ + --set GHC_PACKAGE_PATH "\$(echo $out/lib/*/package.conf.d| tr ' ' ':'):" \ + ''; + }; +in stdenv.lib.overrideDerivation drv (x : { buildInputs = x.buildInputs ++ [ makeWrapper ]; }) \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 04a592a7e566..0ff4acdbc93e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1566,6 +1566,12 @@ let inherit (haskellPackages) ihaskell ghc; }; + ihaskell-with-packages = callPackage ../development/tools/haskell/ihaskell/ng-wrapper.nix { + inherit (pythonPackages) ipython; + inherit (haskellngPackages) ihaskell ghcWithPackages; + packages = self: []; + }; + imapproxy = callPackage ../tools/networking/imapproxy { }; imapsync = callPackage ../tools/networking/imapsync {