diff --git a/pkgs/development/libraries/haskell/ghc-parser/default.nix b/pkgs/development/libraries/haskell/ghc-parser/default.nix new file mode 100644 index 00000000000..74609e4e1ad --- /dev/null +++ b/pkgs/development/libraries/haskell/ghc-parser/default.nix @@ -0,0 +1,24 @@ +# This file was auto-generated by cabal2nix. Please do NOT edit manually! +# This file was later edited manually in order to add happy and cpphs +# build tools, configurePhase and meta. + +{ cabal, bash, happy, cpphs }: + +cabal.mkDerivation (self: { + pname = "ghc-parser"; + version = "0.1.3.0"; + sha256 = "13p09mj92jh4y0v2r672d49fmlz3l5r2r1lqg0jjy6kj045wcfdn"; + buildTools = [ happy cpphs ]; + configurePhase = '' + ghc --make Setup.hs + substituteInPlace build-parser.sh --replace "/bin/bash" "${bash}/bin/bash" + ./Setup configure --verbose --prefix="$out" + ''; + meta = with self.stdenv.lib; { + homepage = "https://github.com/gibiansky/IHaskell"; + description = "Haskell source parser from GHC"; + license = licenses.mit; + platforms = self.ghc.meta.platforms; + maintainers = with maintainers; [ edwtjo ]; + }; +}) diff --git a/pkgs/development/libraries/haskell/here/default.nix b/pkgs/development/libraries/haskell/here/default.nix new file mode 100644 index 00000000000..2179ad0d85f --- /dev/null +++ b/pkgs/development/libraries/haskell/here/default.nix @@ -0,0 +1,20 @@ +# This file was auto-generated by cabal2nix. Please do NOT edit manually! +# The file was later edited to add the state patch. +# https://github.com/np/here/commit/3c16a4e4ce16c08904454972c0d9b43007d1c0cc + +{ cabal, haskellSrcMeta, mtl, parsec, fetchpatch }: + +cabal.mkDerivation (self: { + pname = "here"; + version = "1.2.5"; + sha256 = "0r7hjsvbx7vshbdhi60955mdfnq6arg5ihfz9f2zyilh4l5cyzwb"; + buildDepends = [ haskellSrcMeta mtl parsec ]; + patches = [ (fetchpatch { url = "https://github.com/np/here/commit/3c16a4e4ce16c08904454972c0d9b43007d1c0cc.patch"; sha256 = "1qibwbcpnl1cg35zvvdd2k8nr6bgd36qbla3naim3g08qaapm82h"; }) ]; + meta = with self.stdenv.lib; { + homepage = "https://github.com/tmhedberg/here"; + description = "Here docs & interpolated strings via quasiquotation"; + license = licenses.bsd3; + platforms = self.ghc.meta.platforms; + maintainers = with maintainers; [ edwtjo ]; + }; +}) diff --git a/pkgs/development/libraries/haskell/system-argv0/default.nix b/pkgs/development/libraries/haskell/system-argv0/default.nix new file mode 100644 index 00000000000..6f0eb038b60 --- /dev/null +++ b/pkgs/development/libraries/haskell/system-argv0/default.nix @@ -0,0 +1,16 @@ +# This file was auto-generated by cabal2nix. Please do NOT edit manually! + +{ cabal, systemFilepath, text }: + +cabal.mkDerivation (self: { + pname = "system-argv0"; + version = "0.1.1"; + sha256 = "1ijfry2r3cypp3zmws6dczk21m4n86fkxjld7yl19gjp46fxllbd"; + buildDepends = [ systemFilepath text ]; + meta = { + homepage = "https://john-millikin.com/software/haskell-filesystem/"; + description = "Get argv[0] as a FilePath"; + license = self.stdenv.lib.licenses.mit; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/tools/haskell/ihaskell/default.nix b/pkgs/development/tools/haskell/ihaskell/default.nix new file mode 100644 index 00000000000..f6505384128 --- /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 00000000000..b2c1362b62f --- /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 00000000000..f98de4af229 --- /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 d4571d8ed50..24f8b0678cd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1414,6 +1414,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 5468dfec5f8..83f29fa5396 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -916,6 +916,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in ghcPaths = callPackage ../development/libraries/haskell/ghc-paths {}; + ghcParser = callPackage ../development/libraries/haskell/ghc-parser {}; + ghcSyb = callPackage ../development/libraries/haskell/ghc-syb {}; ghcSybUtils = callPackage ../development/libraries/haskell/ghc-syb-utils {}; @@ -1107,6 +1109,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in heredoc = callPackage ../development/libraries/haskell/heredoc {}; + here = callPackage ../development/libraries/haskell/here {}; + hexpat = callPackage ../development/libraries/haskell/hexpat {}; hex = callPackage ../development/libraries/haskell/hex {}; @@ -1349,6 +1353,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 { @@ -2437,6 +2443,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in symbol = callPackage ../development/libraries/haskell/symbol {}; + systemArgv0 = callPackage ../development/libraries/haskell/system-argv0 {}; + systemFilepath = callPackage ../development/libraries/haskell/system-filepath {}; systemFileio = callPackage ../development/libraries/haskell/system-fileio {};