From 5765ce1b2d45848bb5e187334b7e708c6d4168aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Thu, 2 Oct 2014 20:53:55 +0200 Subject: [PATCH 1/4] here: added package --- .../libraries/haskell/here/default.nix | 20 +++++++++++++++++++ pkgs/top-level/haskell-packages.nix | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 pkgs/development/libraries/haskell/here/default.nix diff --git a/pkgs/development/libraries/haskell/here/default.nix b/pkgs/development/libraries/haskell/here/default.nix new file mode 100644 index 000000000000..2179ad0d85f0 --- /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/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 943dd6e2f153..0a4b2f2328e4 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1105,6 +1105,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 {}; From bf885a8d8772310e0e38a660a3f18deb9f05a194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Thu, 2 Oct 2014 20:53:55 +0200 Subject: [PATCH 2/4] ghc-parser: added package --- .../libraries/haskell/ghc-parser/default.nix | 24 +++++++++++++++++++ pkgs/top-level/haskell-packages.nix | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 pkgs/development/libraries/haskell/ghc-parser/default.nix 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 000000000000..74609e4e1adc --- /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/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 0a4b2f2328e4..829523c4a0a6 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -914,6 +914,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 {}; From 949b80a2295c1b864b3186fbda39c3114d8a5e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Thu, 2 Oct 2014 20:53:55 +0200 Subject: [PATCH 3/4] system-argv0: added package --- .../libraries/haskell/system-argv0/default.nix | 16 ++++++++++++++++ pkgs/top-level/haskell-packages.nix | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/development/libraries/haskell/system-argv0/default.nix 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 000000000000..6f0eb038b604 --- /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/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 829523c4a0a6..52233ed9b54e 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -2437,6 +2437,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 {}; From 6becaca7b3c4d7b64e94e8d8140576cb5108d157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Thu, 2 Oct 2014 20:53:55 +0200 Subject: [PATCH 4/4] ihaskell: added package --- .../tools/haskell/ihaskell/default.nix | 49 +++++++++++++++++++ .../haskell/ihaskell/use-classy-prelude.patch | 34 +++++++++++++ .../tools/haskell/ihaskell/wrapper.nix | 26 ++++++++++ pkgs/top-level/all-packages.nix | 5 ++ pkgs/top-level/haskell-packages.nix | 2 + 5 files changed, 116 insertions(+) create mode 100644 pkgs/development/tools/haskell/ihaskell/default.nix create mode 100644 pkgs/development/tools/haskell/ihaskell/use-classy-prelude.patch create mode 100644 pkgs/development/tools/haskell/ihaskell/wrapper.nix 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 {