diff --git a/pkgs/development/tools/haskell/ihaskell/default.nix b/pkgs/development/tools/haskell/ihaskell/default.nix new file mode 100644 index 000000000000..f65053841283 --- /dev/null +++ b/pkgs/development/tools/haskell/ihaskell/default.nix @@ -0,0 +1,49 @@ +# This file was auto-generated by cabal2nix. Please do NOT edit manually! +# This file was later edited to add patches, disable testing. +# Also patch the profile config to point to the ihaskell kernel exe + +{ cabal, aeson, base64Bytestring, cereal, classyPrelude, cmdargs +, filepath, ghcParser, ghcPaths, haskeline, haskellSrcExts, here +, hlint, hspec, HTTP, HUnit, MissingH, monoTraversable, mtl, parsec +, random, setenv, shelly, split, stm, strict, systemArgv0 +, systemFilepath, tar, text, transformers, unorderedContainers +, utf8String, uuid, vector, zeromq4Haskell, fetchpatch +}: + +cabal.mkDerivation (self: { + pname = "ihaskell"; + version = "0.4.2.0"; + sha256 = "012rmasdc167w6gl18ysr53737j4p4afk0qcsv81hif92vvg5j1c"; + isLibrary = true; + isExecutable = true; + patches = [ (fetchpatch { url = "https://github.com/gibiansky/IHaskell/pull/288.patch"; sha256 = "022zdz4wnyra6cfa7mq0w2ycsb007cvppn2f1360nr3fa5s9wibg"; }) ]; + prePatch = '' + tar xvf profile/profile.tar -C profile + sed -i -e '1iexe = "'$out'/bin/IHaskell".replace(" ", "\\ ")\' profile/ipython_config.py + ''; + doCheck = false; + buildDepends = [ + aeson base64Bytestring cereal classyPrelude cmdargs filepath + ghcParser ghcPaths haskeline haskellSrcExts here hlint hspec HTTP + HUnit MissingH monoTraversable mtl parsec random shelly split stm + strict systemArgv0 systemFilepath tar text transformers + unorderedContainers utf8String uuid vector zeromq4Haskell + ]; + testDepends = [ # let's keep these anyway + aeson base64Bytestring cereal classyPrelude cmdargs filepath + ghcParser ghcPaths haskeline haskellSrcExts here hlint hspec HTTP + HUnit MissingH monoTraversable mtl parsec random setenv shelly + split stm strict systemArgv0 systemFilepath tar text transformers + unorderedContainers utf8String uuid vector zeromq4Haskell + ]; + postInstall = '' + patchShebangs . + ''; + meta = with self.stdenv.lib; { + homepage = "http://gibiansky.github.io/IHaskell/"; + description = "A Haskell backend kernel for the IPython project"; + license = licenses.mit; + platforms = self.ghc.meta.platforms; + maintainers = with maintainers; [ edwtjo ]; + }; +}) diff --git a/pkgs/development/tools/haskell/ihaskell/use-classy-prelude.patch b/pkgs/development/tools/haskell/ihaskell/use-classy-prelude.patch new file mode 100644 index 000000000000..b2c1362b62fa --- /dev/null +++ b/pkgs/development/tools/haskell/ihaskell/use-classy-prelude.patch @@ -0,0 +1,34 @@ +From fad4e38079e91b13bf1e94732b7494504071b224 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= +Date: Sun, 28 Sep 2014 09:27:40 +0200 +Subject: [PATCH] catMaybes, explicitly use ClassyPrelude + +--- + src/IHaskell/Eval/Completion.hs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/IHaskell/Eval/Completion.hs b/src/IHaskell/Eval/Completion.hs +index 790c903..93d7ac1 100644 +--- a/src/IHaskell/Eval/Completion.hs ++++ b/src/IHaskell/Eval/Completion.hs +@@ -141,7 +141,7 @@ getTrueModuleName name = do + onlyImportDecl _ = Nothing + + -- Get all imports that we use. +- imports <- catMaybes <$> map onlyImportDecl <$> getContext ++ imports <- ClassyPrelude.catMaybes <$> map onlyImportDecl <$> getContext + + -- Find the ones that have a qualified name attached. + -- If this name isn't one of them, it already is the true name. +@@ -178,7 +178,7 @@ completionType line loc target + = Empty + + -- When in a string, complete filenames. +- | cursorInString line loc ++ | cursorInString line loc + = FilePath (getStringTarget lineUpToCursor) (getStringTarget lineUpToCursor) + + -- Complete module names in imports and elsewhere. +-- +2.1.0 + diff --git a/pkgs/development/tools/haskell/ihaskell/wrapper.nix b/pkgs/development/tools/haskell/ihaskell/wrapper.nix new file mode 100644 index 000000000000..f98de4af2290 --- /dev/null +++ b/pkgs/development/tools/haskell/ihaskell/wrapper.nix @@ -0,0 +1,26 @@ +{ stdenv, makeWrapper, ihaskell, ipython, ghc }: + +stdenv.mkDerivation rec { + + name = "ihaskell-" + ihaskell.version ; + + buildInputs = [ makeWrapper ]; + + preferLocalBuild = true; + + buildCommand = '' + 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 "$(find ${ihaskell} -iname "profile.tar")" \ + --set PROFILE_INIT "\$([ ! -d \$PROFILE_DIR ] && mkdir -p \$PROFILE_DIR && tar xvf \$PROFILE_TAR -C \$PROFILE_DIR)" \ + --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/${name}.installedconf" \ + --set GHC_PACKAGE_PATH "\$GHC_PACKAGE_PATH:" # always end with : to include base packages + ''; + + meta = { + description = ihaskell.meta.description; + }; +} \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4777a974d762..30ca80468178 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1404,6 +1404,11 @@ let iftop = callPackage ../tools/networking/iftop { }; + ihaskell = callPackage ../development/tools/haskell/ihaskell/wrapper.nix { + inherit (pythonPackages) ipython; + inherit (haskellPackages) ihaskell ghc; + }; + imapproxy = callPackage ../tools/networking/imapproxy { }; imapsync = callPackage ../tools/networking/imapsync { diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 52233ed9b54e..b3f6466e75e6 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1351,6 +1351,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in ieee754 = callPackage ../development/libraries/haskell/ieee754 {}; + ihaskell = callPackage ../development/tools/haskell/ihaskell {}; + imm = callPackage ../development/libraries/haskell/imm {}; implicit = callPackage ../development/libraries/haskell/implicit {