From 2f4517697eb0882a5047faad3f8f42483f4d417e Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Wed, 4 Jun 2014 14:29:18 +0000 Subject: [PATCH 1/9] Add ssl support to snapServer package. --- pkgs/development/libraries/haskell/snap/server.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/snap/server.nix b/pkgs/development/libraries/haskell/snap/server.nix index 4dca1dea284..e5835948d9e 100644 --- a/pkgs/development/libraries/haskell/snap/server.nix +++ b/pkgs/development/libraries/haskell/snap/server.nix @@ -1,7 +1,7 @@ { cabal, attoparsec, attoparsecEnumerator, blazeBuilder , blazeBuilderEnumerator, caseInsensitive, enumerator , MonadCatchIOTransformers, mtl, network, snapCore, text, time -, unixCompat +, unixCompat, HsOpenSSL, useOpenssl ? false }: cabal.mkDerivation (self: { @@ -12,7 +12,8 @@ cabal.mkDerivation (self: { attoparsec attoparsecEnumerator blazeBuilder blazeBuilderEnumerator caseInsensitive enumerator MonadCatchIOTransformers mtl network snapCore text time unixCompat - ]; + ] ++ self.stdenv.lib.optional useOpenssl HsOpenSSL; + configureFlags = [ ] ++ self.stdenv.lib.optional useOpenssl "-fopenssl"; meta = { homepage = "http://snapframework.com/"; description = "A fast, iteratee-based, epoll-enabled web server for the Snap Framework"; From e0b29501689922319d685c46a6258cb111e9d965 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 28 Jun 2014 21:46:35 -0700 Subject: [PATCH 2/9] Initial work on ghcjs --- .../tools/haskell/Cabal-ghcjs/default.nix | 42 +++++++++++++ .../haskell/cabal-install-ghcjs/#default.nix# | 35 +++++++++++ .../haskell/cabal-install-ghcjs/default.nix | 36 +++++++++++ .../tools/haskell/ghcjs/default.nix | 62 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 1 + pkgs/top-level/haskell-defaults.nix | 4 ++ pkgs/top-level/haskell-packages.nix | 18 ++++++ 7 files changed, 198 insertions(+) create mode 100644 pkgs/development/tools/haskell/Cabal-ghcjs/default.nix create mode 100644 pkgs/development/tools/haskell/cabal-install-ghcjs/#default.nix# create mode 100644 pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix create mode 100644 pkgs/development/tools/haskell/ghcjs/default.nix diff --git a/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix b/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix new file mode 100644 index 00000000000..db0447030f0 --- /dev/null +++ b/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix @@ -0,0 +1,42 @@ +{ cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck +, random, stm, testFramework, testFrameworkHunit +, testFrameworkQuickcheck2, time, zlib, fetchgit +}: + +cabal.mkDerivation (self: { + pname = "Cabal-ghcjs"; + version = "9e87d6a3"; + src = fetchgit { + url = git://github.com/ghcjs/cabal.git; + rev = "9e87d6a39ec63f569fea899fc1ace332ea7eea78"; + sha256 = "07bgsqzmiqzw14i91y5nmk5m9sqnxn503xzv2jan5g33z1vcwdcj"; + }; + preConfigure = "cd Cabal"; + configureFlags = "--program-suffix=-js"; + + # jww (2014-05-31): Why is this failing? + # BuildDeps/InternalLibrary4: + # : [Failed] + # expected: 'setup install' should succeed + # output: "/private/var/folders/8h/tky3qz1d63l05l5jp_nzwzjr0000gn/T/nix-build-haskell-Cabal-ghcjs-ghc7.8.2-9e87d6a3-shared.drv-0/git-export/Cabal/tests/Setup configure --user -w /nix/store/v1gr2sk0117ycn9bmwyp3whgxqkbd5sl-ghc-7.8.2-wrapper/bin/ghc" in PackageTests/BuildDeps/InternalLibrary4/to-install + # Configuring InternalLibrary4-0.2... + # Setup: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with + # Cabal. Use the flag --package-db to specify a package database (it can be used + # multiple times). + doCheck = false; + + buildDepends = [ + filepath HTTP mtl network random stm time zlib QuickCheck + ]; + testDepends = [ + filepath HTTP HUnit mtl network QuickCheck stm testFramework + testFrameworkHunit testFrameworkQuickcheck2 time zlib + ]; + meta = { + homepage = "http://www.haskell.org/cabal/"; + description = "The command-line interface for Cabal and Hackage"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + maintainers = [ self.stdenv.lib.maintainers.andres ]; + }; +}) diff --git a/pkgs/development/tools/haskell/cabal-install-ghcjs/#default.nix# b/pkgs/development/tools/haskell/cabal-install-ghcjs/#default.nix# new file mode 100644 index 00000000000..f761a96bc3f --- /dev/null +++ b/pkgs/development/tools/haskell/cabal-install-ghcjs/#default.nix# @@ -0,0 +1,35 @@ +{ cabal, CabalGhcjs, filepath, HTTP, HUnit, mtl, network, QuickCheck +, random, stm, testFramework, testFrameworkHunit +, testFrameworkQuickcheck2, time, zlib, fetchgit +}: + +cabal.mkDerivation (self: { + pname = "cabal-install-ghcjs"; + version = "9e87d6a3"; + src = fetchgit { + url = git://github.com/ghcjs/cabal.git; + rev = "9e87d6a39ec63f569fea899fc1ace332ea7eea78"; + sha256 = "07bgsqzmiqzw14i91y5nmk5m9sqnxn503xzv2jan5g33z1vcwdcj"; + }; + isLibrary = true; + isExecutable = true; + preConfigure = "cd cabal-install"; + buildDepends = [ + CabalGhcjs filepath HTTP mtl network random stm time zlib + ]; + testDepends = [ + CabalGhcjs filepath HTTP HUnit mtl network QuickCheck stm testFramework + testFrameworkHunit testFrameworkQuickcheck2 time zlib + ]; + postInstall = '' + mkdir $out/etc + mv bash-completion $out/etc/bash_completion.d + ''; + meta = { + homepage = "http://www.haskell.org/cabal/"; + description = "The command-line interface for Cabal and Hackage"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + maintainers = [ self.stdenv.lib.maintainers.andres ]; + }; +}) diff --git a/pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix b/pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix new file mode 100644 index 00000000000..9102c77f2f6 --- /dev/null +++ b/pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix @@ -0,0 +1,36 @@ +{ cabal, CabalGhcjs, filepath, HTTP, HUnit, mtl, network, QuickCheck +, random, stm, testFramework, testFrameworkHunit +, testFrameworkQuickcheck2, time, zlib, fetchgit +}: + +cabal.mkDerivation (self: { + pname = "cabal-install-ghcjs"; + version = "9e87d6a3"; + src = fetchgit { + url = git://github.com/ghcjs/cabal.git; + rev = "9e87d6a39ec63f569fea899fc1ace332ea7eea78"; + sha256 = "07bgsqzmiqzw14i91y5nmk5m9sqnxn503xzv2jan5g33z1vcwdcj"; + }; + isLibrary = true; + isExecutable = true; + configureFlags = "--program-suffix=-js"; + preConfigure = "cd cabal-install"; + buildDepends = [ + CabalGhcjs filepath HTTP mtl network random stm time zlib + ]; + testDepends = [ + CabalGhcjs filepath HTTP HUnit mtl network QuickCheck stm testFramework + testFrameworkHunit testFrameworkQuickcheck2 time zlib + ]; + postInstall = '' + mkdir $out/etc + mv bash-completion $out/etc/bash_completion.d + ''; + meta = { + homepage = "http://www.haskell.org/cabal/"; + description = "The command-line interface for Cabal and Hackage"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + maintainers = [ self.stdenv.lib.maintainers.andres ]; + }; +}) diff --git a/pkgs/development/tools/haskell/ghcjs/default.nix b/pkgs/development/tools/haskell/ghcjs/default.nix new file mode 100644 index 00000000000..cf7c49b237a --- /dev/null +++ b/pkgs/development/tools/haskell/ghcjs/default.nix @@ -0,0 +1,62 @@ +{ cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm +, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time +, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable +, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2 +, parallel, safe, shelly, split, stringsearch, syb, systemFileio +, systemFilepath, tar, terminfo, textBinary, unorderedContainers +, vector, wlPprintText, yaml, fetchgit, Cabal, cabalInstall +, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch +, automake, libtool +}: + +cabal.mkDerivation (self: rec { + pname = "ghcjs"; + version = "c9ce6b9d"; + src = fetchgit { + url = git://github.com/ghcjs/ghcjs.git; + rev = "c9ce6b9d87296b1236d5ef0f7d5236b2cedcff84"; + sha256 = "0cla5bchprc8g5n39fkssnv3lj378h948irsnr7dslaki6laaagw"; + }; + bootSrc = fetchgit { + url = git://github.com/ghcjs/ghcjs-boot.git; + rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81"; + sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8"; + }; + isLibrary = true; + isExecutable = true; + jailbreak = true; + noHaddock = true; + buildDepends = [ + filepath HTTP mtl network random stm time zlib aeson attoparsec + bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta + lens optparseApplicative_0_7_0_2 parallel safe shelly split + stringsearch syb systemFileio systemFilepath tar terminfo textBinary + unorderedContainers vector wlPprintText yaml + alex happy git gnumake gcc autoconf automake libtool patch + ]; + testDepends = [ + HUnit regexPosix testFramework testFrameworkHunit + ]; + postConfigure = '' + echo Patching ghcjs with absolute paths to the Nix store + sed -i -e "s|getAppUserDataDirectory \"ghcjs\"|return \"$out/share/ghcjs\"|" \ + src/Compiler/Info.hs + sed -i -e "s|str = \\[\\]|str = [\"--prefix=$out\", \"--libdir=$prefix/lib/$compiler\", \"--libsubdir=$pkgid\"]|" \ + src-bin/Boot.hs + ''; + postInstall = '' + cp -R ${bootSrc} ghcjs-boot + cd ghcjs-boot + chmod -R u+w . # because fetchgit made it read-only + ensureDir $out/share/ghcjs + PATH=$out/bin:${Cabal}/bin:$PATH \ + $out/bin/ghcjs-boot --init --with-cabal ${cabalInstall}/bin/cabal-js + ''; + meta = { + homepage = "https://github.com/ghcjs/ghcjs"; + description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + maintainers = [ self.stdenv.lib.maintainers.jwiegley ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 796da97595e..8973819071a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2956,6 +2956,7 @@ let # Reasonably current HEAD snapshot. haskellPackages_ghc782 = haskell.packages_ghc782; haskellPackages_ghcHEAD = haskell.packages_ghcHEAD; + haskellPackages_ghcjs = haskell.packages_ghcjs; haskellPlatformPackages = recurseIntoAttrs (import ../development/libraries/haskell/haskell-platform { inherit pkgs; }); diff --git a/pkgs/top-level/haskell-defaults.nix b/pkgs/top-level/haskell-defaults.nix index a770cbdda8f..bd447aed065 100644 --- a/pkgs/top-level/haskell-defaults.nix +++ b/pkgs/top-level/haskell-defaults.nix @@ -214,6 +214,10 @@ }; }; + packages_ghcjs = packages_ghc782 // { + ghc = ../development/tools/haskell/ghcjs; + }; + packages_ghc782 = packages { ghcPath = ../development/compilers/ghc/7.8.2.nix; ghcBinary = ghc742Binary; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index c9071817a53..6c091fac581 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -843,6 +843,11 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in cabal = self.cabal.override { enableLibraryProfiling = false; }; # pkg cannot be built with profiling enabled }; + ghcjs = callPackage ../development/tools/haskell/ghcjs { + Cabal = self.Cabal_1_18_1_3; + cabalInstall = self.cabalInstallGhcjs; + }; + ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-codemirror {}; ghcjsCodemirror = callPackage ../development/libraries/haskell/ghcjs-codemirror {}; @@ -2825,6 +2830,19 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in cabalInstall_1_20_0_2 = callPackage ../tools/package-management/cabal-install/1.20.0.2.nix { Cabal = self.Cabal_1_20_0_1; }; cabalInstall = self.cabalInstall_1_20_0_2; + CabalGhcjs = callPackage ../development/tools/haskell/Cabal-ghcjs { + QuickCheck = self.QuickCheck_2_6; + testFrameworkQuickcheck2 = self.testFrameworkQuickcheck2.override { + QuickCheck = self.QuickCheck_2_6; + }; + }; + cabalInstallGhcjs = callPackage ../development/tools/haskell/cabal-install-ghcjs { + QuickCheck = self.QuickCheck_2_6; + testFrameworkQuickcheck2 = self.testFrameworkQuickcheck2.override { + QuickCheck = self.QuickCheck_2_6; + }; + }; + codex = callPackage ../development/tools/haskell/codex {}; commandQq = callPackage ../development/libraries/haskell/command-qq {}; From edcfe3cab6a9cc9ea197a9380a74b0b2b57e623e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 31 May 2014 07:33:49 +0000 Subject: [PATCH 3/9] haskell-optparse-applicative: make 0.7.0.2 available --- .../haskell/optparse-applicative/0.7.0.2.nix | 22 +++++++++++++++++++ .../{default.nix => 0.9.0.nix} | 0 pkgs/top-level/haskell-packages.nix | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/haskell/optparse-applicative/0.7.0.2.nix rename pkgs/development/libraries/haskell/optparse-applicative/{default.nix => 0.9.0.nix} (100%) diff --git a/pkgs/development/libraries/haskell/optparse-applicative/0.7.0.2.nix b/pkgs/development/libraries/haskell/optparse-applicative/0.7.0.2.nix new file mode 100644 index 00000000000..ae211346c90 --- /dev/null +++ b/pkgs/development/libraries/haskell/optparse-applicative/0.7.0.2.nix @@ -0,0 +1,22 @@ +{ cabal, ansiWlPprint, HUnit, QuickCheck, testFramework +, testFrameworkHunit, testFrameworkQuickcheck2 +, testFrameworkThPrime, transformers, transformersCompat +}: + +cabal.mkDerivation (self: { + pname = "optparse-applicative"; + version = "0.7.0.2"; + sha256 = "1pq620236x8fch9nkq4g4vganbzksnwj8z1bb80c2mwvf6sbg5ci"; + buildDepends = [ ansiWlPprint transformers transformersCompat ]; + testDepends = [ + HUnit QuickCheck testFramework testFrameworkHunit + testFrameworkQuickcheck2 testFrameworkThPrime + ]; + jailbreak = true; + meta = { + homepage = "https://github.com/pcapriotti/optparse-applicative"; + description = "Utilities and combinators for parsing command line options"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/libraries/haskell/optparse-applicative/default.nix b/pkgs/development/libraries/haskell/optparse-applicative/0.9.0.nix similarity index 100% rename from pkgs/development/libraries/haskell/optparse-applicative/default.nix rename to pkgs/development/libraries/haskell/optparse-applicative/0.9.0.nix diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 6c091fac581..3fdbb2734ae 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1644,7 +1644,9 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in options = callPackage ../development/libraries/haskell/options {}; - optparseApplicative = callPackage ../development/libraries/haskell/optparse-applicative {}; + optparseApplicative_0_7_0_2 = callPackage ../development/libraries/haskell/optparse-applicative/0.7.0.2.nix {}; + optparseApplicative_0_9_0 = callPackage ../development/libraries/haskell/optparse-applicative/0.9.0.nix {}; + optparseApplicative = self.optparseApplicative_0_9_0; pathPieces = callPackage ../development/libraries/haskell/path-pieces {}; From 9cc408303a23e353f3ac6a56af8ce9dc1488dd9f Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 31 May 2014 06:05:34 +0000 Subject: [PATCH 4/9] haskell-text-binary: new expression --- .../libraries/haskell/text-binary/default.nix | 14 ++++++++++++++ pkgs/top-level/haskell-packages.nix | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/development/libraries/haskell/text-binary/default.nix diff --git a/pkgs/development/libraries/haskell/text-binary/default.nix b/pkgs/development/libraries/haskell/text-binary/default.nix new file mode 100644 index 00000000000..a1d274a6362 --- /dev/null +++ b/pkgs/development/libraries/haskell/text-binary/default.nix @@ -0,0 +1,14 @@ +{ cabal, binary, text }: + +cabal.mkDerivation (self: { + pname = "text-binary"; + version = "0.1.0"; + sha256 = "0wc501j8hqspnhf4d1hyb18f1wgc4kl2qx1b5s4bkxv0dfbwrk6z"; + buildDepends = [ binary text ]; + meta = { + homepage = "https://github.com/kawu/text-binary"; + description = "Binary instances for text types"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 3fdbb2734ae..46aac09b50c 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -2260,6 +2260,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in text_1_1_1_3 = callPackage ../development/libraries/haskell/text/1.1.1.3.nix {}; text = self.text_1_1_1_3; + textBinary = callPackage ../development/libraries/haskell/text-binary {}; + textFormat = callPackage ../development/libraries/haskell/text-format {}; textIcu = callPackage ../development/libraries/haskell/text-icu {}; From 4e7aa4be874d2d0f10da4eb41ef9ec14c14b72bf Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Mon, 30 Jun 2014 00:49:35 -0400 Subject: [PATCH 5/9] Make ghcjs build. Note: In order to run ghcjs, you must set LD_LIBRARY_PATH=${ghcjs}/lib/ghc-7.8.2/ghcjs-0.1.0:$LD_LIBRARY_PATH so that it can find libHSghcjs-0.1.0-ghc7.8.2.so * ghcjs itself (as opposed to ghcjs-built libraries) must be built with the non-ghcjs version of cabal. I'm not sure whether this is strictly necessary, but it prevented an error. * CabalGhcjs and cabalInstallGhcjs must be explicitly provided to ghcjs-boot * Since ghcjs-boot writes to its home directory, we set the home directory to our working directory * To enable ghcjs-boot to find a particular .h file, we must create a symlink in ghcjs-boot/boot to its parent directory * gmp must be provided. Adding it to the LD_LIBRARY_PATH is necessary, but I am not sure whether the uses in buildDepends and the arguments to ghcjs-boot are necessary * If ghcjs-boot cannot find the shims package, it will attempt (and fail) to download it, so we must put it in place ahead of time --- .../tools/haskell/ghcjs/default.nix | 22 ++++++++++++++----- pkgs/top-level/haskell-packages.nix | 1 - 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/development/tools/haskell/ghcjs/default.nix b/pkgs/development/tools/haskell/ghcjs/default.nix index cf7c49b237a..be12c31b91d 100644 --- a/pkgs/development/tools/haskell/ghcjs/default.nix +++ b/pkgs/development/tools/haskell/ghcjs/default.nix @@ -4,9 +4,9 @@ , haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2 , parallel, safe, shelly, split, stringsearch, syb, systemFileio , systemFilepath, tar, terminfo, textBinary, unorderedContainers -, vector, wlPprintText, yaml, fetchgit, Cabal, cabalInstall +, vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall , regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch -, automake, libtool +, automake, libtool, cabalInstallGhcjs, gmp }: cabal.mkDerivation (self: rec { @@ -22,6 +22,11 @@ cabal.mkDerivation (self: rec { rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81"; sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8"; }; + shims = fetchgit { + url = git://github.com/ghcjs/shims.git; + rev = "a6dd0202dcdb86ad63201495b8b5d9763483eb35"; + sha256 = "07cd7ijw4i62iz1xjpwilriiybpqdx246w8d3j27ny1xfsj9wnax"; + }; isLibrary = true; isExecutable = true; jailbreak = true; @@ -32,7 +37,7 @@ cabal.mkDerivation (self: rec { lens optparseApplicative_0_7_0_2 parallel safe shelly split stringsearch syb systemFileio systemFilepath tar terminfo textBinary unorderedContainers vector wlPprintText yaml - alex happy git gnumake gcc autoconf automake libtool patch + alex happy git gnumake gcc autoconf automake libtool patch gmp ]; testDepends = [ HUnit regexPosix testFramework testFrameworkHunit @@ -45,12 +50,17 @@ cabal.mkDerivation (self: rec { src-bin/Boot.hs ''; postInstall = '' + export HOME=$(pwd) cp -R ${bootSrc} ghcjs-boot cd ghcjs-boot + ( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot ) chmod -R u+w . # because fetchgit made it read-only - ensureDir $out/share/ghcjs - PATH=$out/bin:${Cabal}/bin:$PATH \ - $out/bin/ghcjs-boot --init --with-cabal ${cabalInstall}/bin/cabal-js + local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2 + ensureDir $GHCJS_LIBDIR + cp -R ${shims} $GHCJS_LIBDIR/shims + ${cabalInstallGhcjs}/bin/cabal-js update + PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \ + env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --init --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib ''; meta = { homepage = "https://github.com/ghcjs/ghcjs"; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 46aac09b50c..53816711893 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -845,7 +845,6 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in ghcjs = callPackage ../development/tools/haskell/ghcjs { Cabal = self.Cabal_1_18_1_3; - cabalInstall = self.cabalInstallGhcjs; }; ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-codemirror {}; From 50275ff2ee25dd9e9fda2cb472f6a72a97410975 Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Sat, 5 Jul 2014 17:08:41 -0400 Subject: [PATCH 6/9] Make the version number match the cabal file's version number. This is necessary because otherwise the linker flags given at pkgs/build-support/cabal/default.nix:201-203 are ineffective, which causes the built binary to be unable to find its .so file at runtime. This appears to only affect executables that are built in the same cabal package as the library they require. --- pkgs/development/tools/haskell/ghcjs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/haskell/ghcjs/default.nix b/pkgs/development/tools/haskell/ghcjs/default.nix index be12c31b91d..65d68a5089f 100644 --- a/pkgs/development/tools/haskell/ghcjs/default.nix +++ b/pkgs/development/tools/haskell/ghcjs/default.nix @@ -11,7 +11,7 @@ cabal.mkDerivation (self: rec { pname = "ghcjs"; - version = "c9ce6b9d"; + version = "0.1.0"; src = fetchgit { url = git://github.com/ghcjs/ghcjs.git; rev = "c9ce6b9d87296b1236d5ef0f7d5236b2cedcff84"; From df0e96175cd75f8b0490edee4519de711d9511ef Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Thu, 21 Aug 2014 14:56:04 -0400 Subject: [PATCH 7/9] ghcjs is mostly working. --- pkgs/build-support/cabal/ghcjs.nix | 279 ++++++++++++++++++ pkgs/development/compilers/ghcjs/wrapper.nix | 77 +++++ .../libraries/haskell/derive/default.nix | 4 +- .../libraries/haskell/old-time/1.1.0.2.nix | 12 + .../tools/haskell/Cabal-ghcjs/default.nix | 2 +- pkgs/development/tools/misc/cpphs/default.nix | 4 +- pkgs/top-level/haskell-defaults.nix | 91 +++++- pkgs/top-level/haskell-packages.nix | 8 +- 8 files changed, 463 insertions(+), 14 deletions(-) create mode 100644 pkgs/build-support/cabal/ghcjs.nix create mode 100644 pkgs/development/compilers/ghcjs/wrapper.nix create mode 100644 pkgs/development/libraries/haskell/old-time/1.1.0.2.nix diff --git a/pkgs/build-support/cabal/ghcjs.nix b/pkgs/build-support/cabal/ghcjs.nix new file mode 100644 index 00000000000..346165571d7 --- /dev/null +++ b/pkgs/build-support/cabal/ghcjs.nix @@ -0,0 +1,279 @@ +# generic builder for Cabal packages + +{ stdenv, fetchurl, lib, pkgconfig, ghcjs, ghc, Cabal, jailbreakCabal, glibcLocales +, gnugrep, coreutils, hscolour # hscolour is unused +, enableLibraryProfiling ? false +, enableSharedLibraries ? false +, enableSharedExecutables ? false +, enableStaticLibraries ? true +, enableCheckPhase ? stdenv.lib.versionOlder "7.4" ghc.version +, enableHyperlinkSource ? false +, extension ? (self : super : {}) +}: + +let + enableFeature = stdenv.lib.enableFeature; + versionOlder = stdenv.lib.versionOlder; + optional = stdenv.lib.optional; + optionals = stdenv.lib.optionals; + optionalString = stdenv.lib.optionalString; + filter = stdenv.lib.filter; +in + +builtins.trace (ghc.parent.CabalGhcjs.version or null) { + mkDerivation = + args : # arguments for the individual package, can modify the defaults + let # These attributes are removed in the end. This is in order not to spoil the build + # environment overly, but also to keep hash-backwards-compatible with the old cabal.nix. + internalAttrs = [ + "internalAttrs" "buildDepends" "buildTools" "extraLibraries" "pkgconfigDepends" + "isLibrary" "isExecutable" "testDepends" + ]; + + # Stuff happening after the user preferences have been processed. We remove + # internal attributes and strip null elements from the dependency lists, all + # in the interest of keeping hashes stable. + postprocess = + x : (removeAttrs x internalAttrs) // { + buildInputs = filter (y : ! (y == null)) x.buildInputs; + propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs; + propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs; + doCheck = enableCheckPhase && x.doCheck; + hyperlinkSource = enableHyperlinkSource && x.hyperlinkSource; + }; + + defaults = + self : { # self is the final version of the attribute set + + # pname should be defined by the client to be the package basename + # version should be defined by the client to be the package version + + # fname is the internal full name of the package + fname = "${self.pname}-${self.version}"; + + # name is the external full name of the package; usually we prefix + # all packages with haskell- to avoid name clashes for libraries; + # if that is not desired (for applications), name can be set to + # fname. + name = if self.isLibrary then + if enableLibraryProfiling && self.enableSharedLibraries then + "haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-profiling-shared" + else if enableLibraryProfiling && !self.enableSharedLibraries then + "haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-profiling" + else if !enableLibraryProfiling && self.enableSharedLibraries then + "haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-shared" + else + "haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}" + else + "${self.pname}-${self.version}"; + + # the default download location for Cabal packages is Hackage, + # you still have to specify the checksum + src = fetchurl { + url = "mirror://hackage/${self.pname}/${self.fname}.tar.gz"; + inherit (self) sha256; + }; + + # default buildInputs are just ghc, if more buildInputs are required + # buildInputs can be extended by the client by using extraBuildInputs, + # but often propagatedBuildInputs is preferable anyway + buildInputs = [ghc ghc.ghc.parent.CabalGhcjs] ++ self.extraBuildInputs; + extraBuildInputs = self.buildTools ++ + (optionals self.doCheck self.testDepends) ++ + (if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++ + (if self.isLibrary then [] else self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends); + + # we make sure that propagatedBuildInputs is defined, so that we don't + # have to check for its existence + propagatedBuildInputs = if self.isLibrary then self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends else []; + + # By default, also propagate all dependencies to the user environment. This is required, otherwise packages would be broken, because + # GHC also needs all dependencies to be available. + propagatedUserEnvPkgs = if self.isLibrary then self.buildDepends else []; + + # library directories that have to be added to the Cabal files + extraLibDirs = []; + + # build-depends Cabal field + buildDepends = []; + + # target(s) passed to the cabal build phase as an argument + buildTarget = ""; + + # build-depends Cabal fields stated in test-suite stanzas + testDepends = []; + + # target(s) passed to the cabal test phase as an argument + testTarget = ""; + + # build-tools Cabal field + buildTools = []; + + # extra-libraries Cabal field + extraLibraries = []; + + # pkgconfig-depends Cabal field + pkgconfigDepends = []; + + isLibrary = ! self.isExecutable; + isExecutable = false; + + # ignore version restrictions on the build inputs that the cabal file might specify + jailbreak = false; + + # pass the '--enable-split-objs' flag to cabal in the configure stage + enableSplitObjs = false; # !stdenv.isDarwin; # http://hackage.haskell.org/trac/ghc/ticket/4013 + + # pass the '--enable-tests' flag to cabal in the configure stage + # and run any regression test suites the package might have + doCheck = false; #enableCheckPhase; + + # pass the '--hyperlink-source' flag to ./Setup haddock + hyperlinkSource = enableHyperlinkSource; + + # abort the build if the configure phase detects that the package + # depends on multiple versions of the same build input + strictConfigurePhase = true; + + # pass the '--enable-library-vanilla' flag to cabal in the + # configure stage to enable building shared libraries + inherit enableStaticLibraries; + + # pass the '--enable-shared' flag to cabal in the configure + # stage to enable building shared libraries + inherit enableSharedLibraries; + + # pass the '--enable-executable-dynamic' flag to cabal in + # the configure stage to enable linking shared libraries + inherit enableSharedExecutables; + + extraConfigureFlags = [ + (enableFeature self.enableSplitObjs "split-objs") + (enableFeature enableLibraryProfiling "library-profiling") + (enableFeature true "shared") + (optional (versionOlder "7" ghc.version) (enableFeature self.enableStaticLibraries "library-vanilla")) + (optional (versionOlder "7.4" ghc.version) (enableFeature self.enableSharedExecutables "executable-dynamic")) + (optional (versionOlder "7" ghc.version) (enableFeature self.doCheck "tests")) + ]; + + # GHC needs the locale configured during the Haddock phase. + LANG = "en_US.UTF-8"; + LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive"; + + # compiles Setup and configures + configurePhase = '' + set -x + eval "$preConfigure" + + ${optionalString self.jailbreak "${ghc.ghc.parent.jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"} + + PATH=$PATH:${ghc.ghc.ghc}/bin + + for i in Setup.hs Setup.lhs; do + test -f $i && ghc --make $i + done + + for p in $extraBuildInputs $propagatedBuildInputs $propagatedNativeBuildInputs; do + PkgDir="$p/lib/ghcjs-${ghc.ghc.version}_ghc-${ghc.ghc.ghc.version}/package.conf.d" + if [ -f "$PkgDir/package.cache" ]; then + extraConfigureFlags+=" --package-db=$PkgDir" + continue; + fi + if [ -d "$p/include" ]; then + extraConfigureFlags+=" --extra-include-dirs=$p/include" + fi + for d in lib{,64}; do + if [ -d "$p/$d" ]; then + extraConfigureFlags+=" --extra-lib-dirs=$p/$d" + fi + done + done + + configureFlags+=" --package-db=/nix/store/a68nrd3slc39pgl4s3n485s6nfk3mnbi-haskell-ghcjs-ghc7.8.2-0.1.0-shared/share/ghcjs/x86_64-linux-0.1.0-7.8.2/package.conf.d" + + ${optionalString (self.enableSharedExecutables && self.stdenv.isLinux) '' + configureFlags+=" --ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.ghc.name}/${self.pname}-${self.version}"; + ''} + ${optionalString (self.enableSharedExecutables && self.stdenv.isDarwin) '' + configureFlags+=" --ghc-option=-optl=-Wl,-headerpad_max_install_names"; + ''} + + echo "configure flags: $extraConfigureFlags $configureFlags" + ./Setup configure --ghcjs --verbose --prefix="$out" --libdir='$prefix/lib/$compiler' \ + --libsubdir='$pkgid' $extraConfigureFlags $configureFlags 2>&1 \ + ${optionalString self.strictConfigurePhase '' + | ${coreutils}/bin/tee "$NIX_BUILD_TOP/cabal-configure.log" + if ${gnugrep}/bin/egrep -q '^Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then + echo >&2 "*** abort because of serious configure-time warning from Cabal" + exit 1 + fi + ''} + + eval "$postConfigure" + ''; + + # builds via Cabal + buildPhase = '' + eval "$preBuild" + + ./Setup build ${self.buildTarget} + + export GHC_PACKAGE_PATH=$(${ghc.GHCPackages}) + #test -n "$noHaddock" || ./Setup haddock --html --hoogle \ + # ${optionalString self.hyperlinkSource "--hyperlink-source"} + + eval "$postBuild" + ''; + + checkPhase = optional self.doCheck '' + eval "$preCheck" + + ./Setup test ${self.testTarget} + + eval "$postCheck" + ''; + + # installs via Cabal; creates a registration file for nix-support + # so that the package can be used in other Haskell-builds; also + # adds all propagated build inputs to the user environment packages + installPhase = '' + eval "$preInstall" + + ./Setup copy + + ensureDir $out/bin # necessary to get it added to PATH + + local confDir=$out/lib/ghcjs-${ghc.ghc.version}_ghc-${ghc.ghc.ghc.version}/package.conf.d + local installedPkgConf=$confDir/${self.fname}.installedconf + local pkgConf=$confDir/${self.fname}.conf + ensureDir $confDir + ./Setup register --gen-pkg-config=$pkgConf + if test -f $pkgConf; then + echo '[]' > $installedPkgConf + GHC_PACKAGE_PATH=$installedPkgConf ghcjs-pkg --global register $pkgConf --force --package-db=$confDir || true + ghcjs-pkg recache --package-db=$confDir + fi + + if test -f $out/nix-support/propagated-native-build-inputs; then + ln -s $out/nix-support/propagated-native-build-inputs $out/nix-support/propagated-user-env-packages + fi + + ${optionalString (self.enableSharedExecutables && self.isExecutable && self.stdenv.isDarwin) '' + for exe in $out/bin/* ; do + install_name_tool -add_rpath \ + $out/lib/${ghc.ghc.name}/${self.pname}-${self.version} $exe + done + ''} + + eval "$postInstall" + ''; + + # We inherit stdenv and ghc so that they can be used + # in Cabal derivations. + inherit stdenv ghc; + }; + in + stdenv.mkDerivation (postprocess (let super = defaults self // args self; + self = super // extension self super; + in self)); +} diff --git a/pkgs/development/compilers/ghcjs/wrapper.nix b/pkgs/development/compilers/ghcjs/wrapper.nix new file mode 100644 index 00000000000..fa1336fec27 --- /dev/null +++ b/pkgs/development/compilers/ghcjs/wrapper.nix @@ -0,0 +1,77 @@ +{ stdenv, ghc, makeWrapper, coreutils, writeScript }: +let + ghcjs = ghc; + packageDBFlag = "-package-db"; + + GHCGetPackages = writeScript "ghc-get-packages.sh" '' + #! ${stdenv.shell} + # Usage: + # $1: version of GHC + # $2: invocation path of GHC + # $3: prefix + version="$1" + if test -z "$3"; then + prefix="${packageDBFlag} " + else + prefix="$3" + fi + PATH="$PATH:$2" + IFS=":" + for p in $PATH; do + for i in "$p/../share/ghcjs/$system-${ghcjs.version}-${ghcjs.ghc.version}"{,/lib}"/package.conf.d" "$p/../lib/ghcjs-${ghc.version}_ghc-${ghc.ghc.version}/package.conf.d" ; do + # output takes place here + test -f $i/package.cache && echo -n " $prefix$i" + done + done + ''; + + GHCPackages = writeScript "ghc-packages.sh" '' + #! ${stdenv.shell} -e + declare -A GHC_PACKAGES_HASH # using bash4 hashs to get uniq paths + + for arg in $(${GHCGetPackages} ${ghcjs.version} "$(dirname $0)"); do # Why is ghc.version passed in from here instead of captured in the other script directly? + case "$arg" in + ${packageDBFlag}) ;; + *) + CANONICALIZED="$(${coreutils}/bin/readlink -f -- "$arg")" + GHC_PACKAGES_HASH["$CANONICALIZED"]= ;; + esac + done + + for path in ''${!GHC_PACKAGES_HASH[@]}; do + echo -n "$path:" + done + ''; +in +stdenv.mkDerivation { + name = "ghcjs-ghc${ghcjs.ghc.version}-${ghcjs.version}-wrapper"; + + buildInputs = [makeWrapper]; + propagatedBuildInputs = [ghcjs]; + + unpackPhase = "true"; + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + for prg in ghcjs ; do + makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$(${GHCGetPackages} ${ghcjs.version} \"\$(dirname \$0)\")" + done + for prg in ghcjs-pkg ; do + makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$(${GHCGetPackages} ${ghcjs.version} \"\$(dirname \$0)\" -${packageDBFlag}=)" + done + + mkdir -p $out/nix-support + ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages + + mkdir -p $out/share/doc + ln -s $ghc/lib $out/lib + ln -s $ghc/share/doc/ghc $out/share/doc/ghc-${ghcjs.version} + + runHook postInstall + ''; + + ghc = ghcjs; + inherit GHCGetPackages GHCPackages; + inherit (ghcjs) meta version; +} diff --git a/pkgs/development/libraries/haskell/derive/default.nix b/pkgs/development/libraries/haskell/derive/default.nix index 5dba1b6af56..1f8584a0277 100644 --- a/pkgs/development/libraries/haskell/derive/default.nix +++ b/pkgs/development/libraries/haskell/derive/default.nix @@ -1,4 +1,4 @@ -{ cabal, filepath, haskellSrcExts, syb, transformers, uniplate }: +{ cabal, process, filepath, haskellSrcExts, syb, transformers, uniplate }: cabal.mkDerivation (self: { pname = "derive"; @@ -7,7 +7,7 @@ cabal.mkDerivation (self: { isLibrary = true; isExecutable = true; buildDepends = [ - filepath haskellSrcExts syb transformers uniplate + process filepath haskellSrcExts syb transformers uniplate ]; meta = { homepage = "http://community.haskell.org/~ndm/derive/"; diff --git a/pkgs/development/libraries/haskell/old-time/1.1.0.2.nix b/pkgs/development/libraries/haskell/old-time/1.1.0.2.nix new file mode 100644 index 00000000000..eab8e3e5c63 --- /dev/null +++ b/pkgs/development/libraries/haskell/old-time/1.1.0.2.nix @@ -0,0 +1,12 @@ +{ cabal }: + +cabal.mkDerivation (self: { + pname = "old-time"; + version = "1.1.0.2"; + sha256 = "1nrqbpwxsmga13gcyn7bg25gkm61fmix07gm76d1f1i4impgqw1r"; + meta = { + description = "Time library"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix b/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix index db0447030f0..6613adba19c 100644 --- a/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix +++ b/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix @@ -4,7 +4,7 @@ }: cabal.mkDerivation (self: { - pname = "Cabal-ghcjs"; + pname = "Cabal"; version = "9e87d6a3"; src = fetchgit { url = git://github.com/ghcjs/cabal.git; diff --git a/pkgs/development/tools/misc/cpphs/default.nix b/pkgs/development/tools/misc/cpphs/default.nix index 72a6571f3cc..ce6042de7fa 100644 --- a/pkgs/development/tools/misc/cpphs/default.nix +++ b/pkgs/development/tools/misc/cpphs/default.nix @@ -1,4 +1,4 @@ -{ cabal, polyparse }: +{ cabal, polyparse, oldTime }: cabal.mkDerivation (self: { pname = "cpphs"; @@ -6,7 +6,7 @@ cabal.mkDerivation (self: { sha256 = "0rmcq66wn7lsc5g1wk6bbsr7jiw8h6bz5cbvdywnv7vmwsx8gh51"; isLibrary = true; isExecutable = true; - buildDepends = [ polyparse ]; + buildDepends = [ oldTime polyparse ]; meta = { homepage = "http://projects.haskell.org/cpphs/"; description = "A liberalised re-implementation of cpp, the C pre-processor"; diff --git a/pkgs/top-level/haskell-defaults.nix b/pkgs/top-level/haskell-defaults.nix index bd447aed065..6d58eee927e 100644 --- a/pkgs/top-level/haskell-defaults.nix +++ b/pkgs/top-level/haskell-defaults.nix @@ -135,20 +135,23 @@ # Abstraction for Haskell packages collections packagesFun = makeOverridable - ({ ghcPath + ({ ghcPath ? null + , ghc ? callPackage ghcPath ({ ghc = ghcBinary; } // extraArgs) , ghcBinary ? ghc6101Binary , prefFun , extension ? (self : super : {}) , profExplicit ? false, profDefault ? false , modifyPrio ? lowPrio , extraArgs ? {} + , cabalPackage ? import ../build-support/cabal + , ghcWrapperPackage ? import ../development/compilers/ghc/wrapper.nix } : let haskellPackagesClass = import ./haskell-packages.nix { - inherit pkgs newScope modifyPrio; + inherit pkgs newScope modifyPrio cabalPackage ghcWrapperPackage; enableLibraryProfiling = if profExplicit then profDefault else config.cabal.libraryProfiling or profDefault; - ghc = callPackage ghcPath ({ ghc = ghcBinary; } // extraArgs); + inherit ghc; }; haskellPackagesPrefsClass = self : let super = haskellPackagesClass self; in super // prefFun self super; haskellPackagesExtensionClass = self : let super = haskellPackagesPrefsClass self; in super // extension self super; @@ -214,9 +217,85 @@ }; }; - packages_ghcjs = packages_ghc782 // { - ghc = ../development/tools/haskell/ghcjs; - }; + packages_ghcjs = + let parent = packages_ghc782.override { + extension = self: super: { + Cabal = packages_ghc782.CabalGhcjs; + }; + }; + in packages { + ghc = parent.ghcjs // { inherit parent; }; + cabalPackage = import ../build-support/cabal/ghcjs.nix; + ghcWrapperPackage = import ../development/compilers/ghcjs/wrapper.nix; + prefFun = self : super : super // { + # This is the list of packages that are built into a booted ghcjs installation +# Cabal_1_19_2 = null; +# Cabal = self.Cabal_1_19_2; + Cabal = packages_ghc782.CabalGhcjs; + aeson_0_7_0_4 = null; + aeson = self.aeson_0_7_0_4; + array_0_5_0_0 = null; + array = self.array_0_5_0_0; + attoparsec_0_11_3_1 = null; + attoparsec = self.attoparsec_0_11_3_1; + base_4_7_0_0 = null; + base = self.base_4_7_0_0; + bytestring_0_10_4_0 = null; + bytestring = self.bytestring_0_10_4_0; + containers_0_5_5_1 = null; + containers = self.containers_0_5_5_1; + deepseq_1_3_0_2 = null; + deepseq = self.deepseq_1_3_0_2; + directory_1_2_1_0 = null; + directory = self.directory_1_2_1_0; + dlist_0_7_1 = null; + dlist = self.dlist_0_7_1; + filepath_1_3_0_2 = null; + filepath = self.filepath_1_3_0_2; + ghcPrim_0_3_1_0 = null; + ghcPrim = self.ghcPrim_0_3_1_0; + ghcjsBase_0_1_0_0 = null; + ghcjsBase = self.ghcjsBase_0_1_0_0; + ghcjsPrim_0_1_0_0 = null; + ghcjsPrim = self.ghcjsPrim_0_1_0_0; + hashable_1_2_1_0 = null; + hashable = self.hashable_1_2_1_0; + integerGmp_0_5_1_0 = null; + integerGmp = self.integerGmp_0_5_1_0; + mtl_2_1_3_1 = null; + mtl = self.mtl_2_1_3_1; + oldLocale_1_0_0_6 = null; + oldLocale = self.oldLocale_1_0_0_6; + pretty_1_1_1_1 = null; + pretty = self.pretty_1_1_1_1; + primitive_0_5_3_0 = null; + primitive = self.primitive_0_5_3_0; + # process_1_2_0_0 = null; + # process = self.process_1_2_0_0; + scientific_0_2_0_2 = null; + scientific = self.scientific_0_2_0_2; + syb_0_4_2 = null; + syb = self.syb_0_4_2; + templateHaskell_2_9_0_0 = null; + templateHaskell = self.templateHaskell_2_9_0_0; + text_1_1_1_3 = null; + text = self.text_1_1_1_3; + time_1_4_2 = null; + time = self.time_1_4_2; + transformers_0_3_0_0 = null; + transformers = self.transformers_0_3_0_0; + unix_2_7_0_1 = null; + unix = self.unix_2_7_0_1; + unorderedContainers_0_2_5_0 = null; + unorderedContainers = self.unorderedContainers_0_2_5_0; + vector_0_10_11_0 = null; + vector = self.vector_0_10_11_0; + # These are necessary for compatibility with ghcjs's default libs + transformersCompat = self.transformersCompat_0_3_3; + oldTime = self.oldTime_1_1_0_2; + process = self.process_1_2_0_0; # ghcjs-boot seems to install process incorrectly, for some reason, so reinstall it + }; + }; packages_ghc782 = packages { ghcPath = ../development/compilers/ghc/7.8.2.nix; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 53816711893..f0f561c9c96 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -43,7 +43,7 @@ # # For most packages, however, we keep only one version, and use default.nix. -{ pkgs, newScope, ghc, modifyPrio ? (x : x) +{ pkgs, newScope, ghc, cabalPackage, ghcWrapperPackage, modifyPrio ? (x : x) , enableLibraryProfiling ? false , enableSharedLibraries ? pkgs.stdenv.lib.versionOlder "7.7" ghc.version , enableSharedExecutables ? pkgs.stdenv.lib.versionOlder "7.7" ghc.version @@ -74,7 +74,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in # refers to the function argument at the # top of this file. - ghc = callPackage ../development/compilers/ghc/wrapper.nix { + ghc = callPackage ghcWrapperPackage { ghc = ghc; # refers to ghcPlain }; @@ -94,7 +94,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in # This is the Cabal builder, the function we use to build most Haskell # packages. It isn't the Cabal library, which is spelled "Cabal". - cabal = callPackage ../build-support/cabal { + cabal = callPackage cabalPackage { Cabal = null; # prefer the Cabal version shipped with the compiler hscolour = self.hscolourBootstrap; inherit enableLibraryProfiling enableCheckPhase @@ -2673,6 +2673,8 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in cake3 = callPackage ../development/tools/haskell/cake3 {}; + oldTime_1_1_0_2 = callPackage ../development/libraries/haskell/old-time/1.1.0.2.nix {}; + oldTime = null; # By default, use the built-in old-time library cpphs = callPackage ../development/tools/misc/cpphs {}; DrIFT = callPackage ../development/tools/haskell/DrIFT {}; From 6142b27760b8bf1767a50ccdc398b561e824e40e Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Sat, 23 Aug 2014 15:00:13 -0400 Subject: [PATCH 8/9] ghcjs working. --- pkgs/build-support/cabal/ghcjs.nix | 2 +- pkgs/development/compilers/ghcjs/0.1.0.nix | 72 ++++++++++++ pkgs/development/compilers/ghcjs/wrapper.nix | 2 +- .../libraries/haskell/ghcjs-dom/default.nix | 11 +- .../haskell/lens/{default.nix => 4.2.nix} | 0 .../libraries/haskell/lens/4.4.nix | 32 ++++++ .../haskell/transformers-compat/0.3.3.3.nix | 14 +++ .../tools/haskell/Cabal-ghcjs/default.nix | 4 +- .../haskell/cabal-install-ghcjs/default.nix | 7 +- .../tools/haskell/ghcjs/default.nix | 57 +++++++--- pkgs/top-level/haskell-defaults.nix | 106 +++++++++++++----- pkgs/top-level/haskell-packages.nix | 11 +- 12 files changed, 260 insertions(+), 58 deletions(-) create mode 100644 pkgs/development/compilers/ghcjs/0.1.0.nix rename pkgs/development/libraries/haskell/lens/{default.nix => 4.2.nix} (100%) create mode 100644 pkgs/development/libraries/haskell/lens/4.4.nix create mode 100644 pkgs/development/libraries/haskell/transformers-compat/0.3.3.3.nix diff --git a/pkgs/build-support/cabal/ghcjs.nix b/pkgs/build-support/cabal/ghcjs.nix index 346165571d7..df356b6ac99 100644 --- a/pkgs/build-support/cabal/ghcjs.nix +++ b/pkgs/build-support/cabal/ghcjs.nix @@ -189,7 +189,7 @@ builtins.trace (ghc.parent.CabalGhcjs.version or null) { done done - configureFlags+=" --package-db=/nix/store/a68nrd3slc39pgl4s3n485s6nfk3mnbi-haskell-ghcjs-ghc7.8.2-0.1.0-shared/share/ghcjs/x86_64-linux-0.1.0-7.8.2/package.conf.d" + configureFlags+=" --package-db=${ghc.ghc}/share/ghcjs/x86_64-linux-0.1.0-7.8.2/ghcjs/package.conf.d" ${optionalString (self.enableSharedExecutables && self.stdenv.isLinux) '' configureFlags+=" --ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.ghc.name}/${self.pname}-${self.version}"; diff --git a/pkgs/development/compilers/ghcjs/0.1.0.nix b/pkgs/development/compilers/ghcjs/0.1.0.nix new file mode 100644 index 00000000000..65d68a5089f --- /dev/null +++ b/pkgs/development/compilers/ghcjs/0.1.0.nix @@ -0,0 +1,72 @@ +{ cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm +, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time +, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable +, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2 +, parallel, safe, shelly, split, stringsearch, syb, systemFileio +, systemFilepath, tar, terminfo, textBinary, unorderedContainers +, vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall +, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch +, automake, libtool, cabalInstallGhcjs, gmp +}: + +cabal.mkDerivation (self: rec { + pname = "ghcjs"; + version = "0.1.0"; + src = fetchgit { + url = git://github.com/ghcjs/ghcjs.git; + rev = "c9ce6b9d87296b1236d5ef0f7d5236b2cedcff84"; + sha256 = "0cla5bchprc8g5n39fkssnv3lj378h948irsnr7dslaki6laaagw"; + }; + bootSrc = fetchgit { + url = git://github.com/ghcjs/ghcjs-boot.git; + rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81"; + sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8"; + }; + shims = fetchgit { + url = git://github.com/ghcjs/shims.git; + rev = "a6dd0202dcdb86ad63201495b8b5d9763483eb35"; + sha256 = "07cd7ijw4i62iz1xjpwilriiybpqdx246w8d3j27ny1xfsj9wnax"; + }; + isLibrary = true; + isExecutable = true; + jailbreak = true; + noHaddock = true; + buildDepends = [ + filepath HTTP mtl network random stm time zlib aeson attoparsec + bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta + lens optparseApplicative_0_7_0_2 parallel safe shelly split + stringsearch syb systemFileio systemFilepath tar terminfo textBinary + unorderedContainers vector wlPprintText yaml + alex happy git gnumake gcc autoconf automake libtool patch gmp + ]; + testDepends = [ + HUnit regexPosix testFramework testFrameworkHunit + ]; + postConfigure = '' + echo Patching ghcjs with absolute paths to the Nix store + sed -i -e "s|getAppUserDataDirectory \"ghcjs\"|return \"$out/share/ghcjs\"|" \ + src/Compiler/Info.hs + sed -i -e "s|str = \\[\\]|str = [\"--prefix=$out\", \"--libdir=$prefix/lib/$compiler\", \"--libsubdir=$pkgid\"]|" \ + src-bin/Boot.hs + ''; + postInstall = '' + export HOME=$(pwd) + cp -R ${bootSrc} ghcjs-boot + cd ghcjs-boot + ( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot ) + chmod -R u+w . # because fetchgit made it read-only + local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2 + ensureDir $GHCJS_LIBDIR + cp -R ${shims} $GHCJS_LIBDIR/shims + ${cabalInstallGhcjs}/bin/cabal-js update + PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \ + env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --init --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib + ''; + meta = { + homepage = "https://github.com/ghcjs/ghcjs"; + description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + maintainers = [ self.stdenv.lib.maintainers.jwiegley ]; + }; +}) diff --git a/pkgs/development/compilers/ghcjs/wrapper.nix b/pkgs/development/compilers/ghcjs/wrapper.nix index fa1336fec27..751b7d9a7de 100644 --- a/pkgs/development/compilers/ghcjs/wrapper.nix +++ b/pkgs/development/compilers/ghcjs/wrapper.nix @@ -18,7 +18,7 @@ let PATH="$PATH:$2" IFS=":" for p in $PATH; do - for i in "$p/../share/ghcjs/$system-${ghcjs.version}-${ghcjs.ghc.version}"{,/lib}"/package.conf.d" "$p/../lib/ghcjs-${ghc.version}_ghc-${ghc.ghc.version}/package.conf.d" ; do + for i in "$p/../share/ghcjs/$system-${ghcjs.version}-${ghcjs.ghc.version}"{,/lib,/ghcjs}"/package.conf.d" "$p/../lib/ghcjs-${ghc.version}_ghc-${ghc.ghc.version}/package.conf.d" ; do # output takes place here test -f $i/package.cache && echo -n " $prefix$i" done diff --git a/pkgs/development/libraries/haskell/ghcjs-dom/default.nix b/pkgs/development/libraries/haskell/ghcjs-dom/default.nix index 7ea85f2cb1f..b30bd4ff18b 100644 --- a/pkgs/development/libraries/haskell/ghcjs-dom/default.nix +++ b/pkgs/development/libraries/haskell/ghcjs-dom/default.nix @@ -1,9 +1,14 @@ -{ cabal, ghcjsBase, mtl }: +{ cabal, fetchgit, ghcjsBase, mtl }: cabal.mkDerivation (self: { pname = "ghcjs-dom"; - version = "0.0.10"; - sha256 = "0xffr197m6qam4q7ckgcwl0v9kwrxa5fm894c9vyxdmlcjyn38rm"; + version = "0.1.0.0"; + src = fetchgit { + url = git://github.com/ghcjs/ghcjs-dom.git; + rev = "81805e75ccd41501774b90c04efd9e00d52e9798"; + sha256 = "3aa56fb81974533661aa056ed080edab29bef8ab26dae61999de4452f95949f6"; + }; + buildDepends = [ ghcjsBase mtl ]; meta = { description = "DOM library that supports both GHCJS and WebKitGTK"; diff --git a/pkgs/development/libraries/haskell/lens/default.nix b/pkgs/development/libraries/haskell/lens/4.2.nix similarity index 100% rename from pkgs/development/libraries/haskell/lens/default.nix rename to pkgs/development/libraries/haskell/lens/4.2.nix diff --git a/pkgs/development/libraries/haskell/lens/4.4.nix b/pkgs/development/libraries/haskell/lens/4.4.nix new file mode 100644 index 00000000000..3c05c94129e --- /dev/null +++ b/pkgs/development/libraries/haskell/lens/4.4.nix @@ -0,0 +1,32 @@ +{ cabal, bifunctors, comonad, contravariant, deepseq, distributive +, doctest, exceptions, filepath, free, genericDeriving, hashable +, hlint, HUnit, mtl, nats, parallel, primitive, profunctors +, QuickCheck, reflection, semigroupoids, semigroups, simpleReflect +, split, tagged, testFramework, testFrameworkHunit +, testFrameworkQuickcheck2, testFrameworkTh, text, transformers +, transformersCompat, unorderedContainers, vector, void, zlib +}: + +cabal.mkDerivation (self: { + pname = "lens"; + version = "4.4"; + sha256 = "06ha4px4ywfbi0n3imy2qqjq3656snsz1b0ggkwzvdzmi550sh8w"; + buildDepends = [ + bifunctors comonad contravariant distributive exceptions filepath + free hashable mtl parallel primitive profunctors reflection + semigroupoids semigroups split tagged text transformers + transformersCompat unorderedContainers vector void zlib + ]; + testDepends = [ + deepseq doctest filepath genericDeriving hlint HUnit mtl nats + parallel QuickCheck semigroups simpleReflect split testFramework + testFrameworkHunit testFrameworkQuickcheck2 testFrameworkTh text + transformers unorderedContainers vector + ]; + meta = { + homepage = "http://github.com/ekmett/lens/"; + description = "Lenses, Folds and Traversals"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/libraries/haskell/transformers-compat/0.3.3.3.nix b/pkgs/development/libraries/haskell/transformers-compat/0.3.3.3.nix new file mode 100644 index 00000000000..c0343aa6be7 --- /dev/null +++ b/pkgs/development/libraries/haskell/transformers-compat/0.3.3.3.nix @@ -0,0 +1,14 @@ +{ cabal, transformers }: + +cabal.mkDerivation (self: { + pname = "transformers-compat"; + version = "0.3.3.3"; + sha256 = "18cqghf0gc97j9qnlfnwwhvfm8j4sk99rm0xv3bf6ml8slk7njx7"; + buildDepends = [ transformers ]; + meta = { + homepage = "http://github.com/ekmett/transformers-compat/"; + description = "A small compatibility shim exposing the new types from transformers 0.3 and 0.4 to older Haskell platforms."; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix b/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix index 6613adba19c..16c355a5c99 100644 --- a/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix +++ b/pkgs/development/tools/haskell/Cabal-ghcjs/default.nix @@ -8,8 +8,8 @@ cabal.mkDerivation (self: { version = "9e87d6a3"; src = fetchgit { url = git://github.com/ghcjs/cabal.git; - rev = "9e87d6a39ec63f569fea899fc1ace332ea7eea78"; - sha256 = "07bgsqzmiqzw14i91y5nmk5m9sqnxn503xzv2jan5g33z1vcwdcj"; + rev = "520591876ee57dbecba1b2de602dc79f4f67ecce"; # Must be from the ghcjs branch + sha256 = "f59182661707c65a2a014aa91b5e0d53cbefb6c999c1982757f476619b6728c0"; }; preConfigure = "cd Cabal"; configureFlags = "--program-suffix=-js"; diff --git a/pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix b/pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix index 9102c77f2f6..4fde997fc4c 100644 --- a/pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix +++ b/pkgs/development/tools/haskell/cabal-install-ghcjs/default.nix @@ -6,13 +6,10 @@ cabal.mkDerivation (self: { pname = "cabal-install-ghcjs"; version = "9e87d6a3"; - src = fetchgit { - url = git://github.com/ghcjs/cabal.git; - rev = "9e87d6a39ec63f569fea899fc1ace332ea7eea78"; - sha256 = "07bgsqzmiqzw14i91y5nmk5m9sqnxn503xzv2jan5g33z1vcwdcj"; - }; + src = CabalGhcjs.src; isLibrary = true; isExecutable = true; + doCheck = false; configureFlags = "--program-suffix=-js"; preConfigure = "cd cabal-install"; buildDepends = [ diff --git a/pkgs/development/tools/haskell/ghcjs/default.nix b/pkgs/development/tools/haskell/ghcjs/default.nix index 65d68a5089f..4feffcd7f4c 100644 --- a/pkgs/development/tools/haskell/ghcjs/default.nix +++ b/pkgs/development/tools/haskell/ghcjs/default.nix @@ -1,44 +1,72 @@ -{ cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm +{ nodejs, cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm , testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time , zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable -, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2 +, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative , parallel, safe, shelly, split, stringsearch, syb, systemFileio , systemFilepath, tar, terminfo, textBinary, unorderedContainers , vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall , regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch -, automake, libtool, cabalInstallGhcjs, gmp +, automake, libtool, cabalInstallGhcjs, gmp, base16Bytestring +, cryptohash, executablePath, transformersCompat +, haddock, hspec, xhtml, primitive }: - cabal.mkDerivation (self: rec { pname = "ghcjs"; version = "0.1.0"; src = fetchgit { url = git://github.com/ghcjs/ghcjs.git; - rev = "c9ce6b9d87296b1236d5ef0f7d5236b2cedcff84"; - sha256 = "0cla5bchprc8g5n39fkssnv3lj378h948irsnr7dslaki6laaagw"; + rev = "fd034b7e6fb61120d22f1c314398f37a673b8b1d"; + sha256 = "0182bb706cc263a6d268eb61e243214186abae7b81dec420187c858e989c4dba"; }; +/* bootSrc = fetchgit { url = git://github.com/ghcjs/ghcjs-boot.git; - rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81"; - sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8"; + rev = "f9f79d0cf40212943bcc1ad2672f2e0a7af2b7c9"; + sha256 = "83f1706bcf7e666f6fb6dee455517e0efb019aabd1393f444c80169f04b9d3b8"; }; +*/ shims = fetchgit { url = git://github.com/ghcjs/shims.git; - rev = "a6dd0202dcdb86ad63201495b8b5d9763483eb35"; - sha256 = "07cd7ijw4i62iz1xjpwilriiybpqdx246w8d3j27ny1xfsj9wnax"; + rev = "dc5bb54778f3dbba4b463f4f7df5f830f14d1cb6"; + sha256 = "fcef2879df0735b1011a8642a7c3e0e3f39b7d395830b91a992658f4ff67c9ce"; }; isLibrary = true; isExecutable = true; jailbreak = true; noHaddock = true; + haddockInternal = cabal.mkDerivation (self: { + pname = "haddock-internal"; + version = "2.14.3"; + src = fetchgit { + url = git://github.com/ghcjs/haddock-internal.git; + rev = "47758773d6b20c395a1c76a93830070fde71dbab"; + sha256 = "df1a024631b7781fcbda09d2b33a56650959b8ab6c831151b456133226ab90b2"; + }; + buildDepends = [ QuickCheck ghcPaths haddock hspec xhtml ]; # Can't specify Cabal here, or it ends up being the wrong version + doCheck = false; + }); + ghcjsPrim = cabal.mkDerivation (self: { + pname = "ghcjs-prim"; + version = "0.1.0.0"; + src = fetchgit { + url = git://github.com/ghcjs/ghcjs-prim.git; + rev = "659d6ceb45b1b8ef526c7451d90afff80d76e2f5"; + sha256 = "55b64d93cdc8220042a35ea12f8c53e82f78b51bc0f87ddd12300ad56e4b7ba7"; + }; + buildDepends = [ primitive ]; + }); buildDepends = [ filepath HTTP mtl network random stm time zlib aeson attoparsec bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta - lens optparseApplicative_0_7_0_2 parallel safe shelly split + lens optparseApplicative parallel safe shelly split stringsearch syb systemFileio systemFilepath tar terminfo textBinary unorderedContainers vector wlPprintText yaml alex happy git gnumake gcc autoconf automake libtool patch gmp + base16Bytestring cryptohash executablePath haddockInternal + transformersCompat QuickCheck haddock hspec xhtml + ghcjsPrim ]; + buildTools = [ nodejs git ]; testDepends = [ HUnit regexPosix testFramework testFrameworkHunit ]; @@ -51,8 +79,11 @@ cabal.mkDerivation (self: rec { ''; postInstall = '' export HOME=$(pwd) - cp -R ${bootSrc} ghcjs-boot + export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt + git clone git://github.com/ghcjs/ghcjs-boot.git cd ghcjs-boot + git checkout f9f79d0cf40212943bcc1ad2672f2e0a7af2b7c9 + git submodule update --init --recursive ( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot ) chmod -R u+w . # because fetchgit made it read-only local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2 @@ -60,7 +91,7 @@ cabal.mkDerivation (self: rec { cp -R ${shims} $GHCJS_LIBDIR/shims ${cabalInstallGhcjs}/bin/cabal-js update PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \ - env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --init --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib + env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --dev --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib ''; meta = { homepage = "https://github.com/ghcjs/ghcjs"; diff --git a/pkgs/top-level/haskell-defaults.nix b/pkgs/top-level/haskell-defaults.nix index 6d58eee927e..defd7bfa54d 100644 --- a/pkgs/top-level/haskell-defaults.nix +++ b/pkgs/top-level/haskell-defaults.nix @@ -221,6 +221,10 @@ let parent = packages_ghc782.override { extension = self: super: { Cabal = packages_ghc782.CabalGhcjs; + transformersCompat = super.transformersCompat_0_3_3_3; + haddock = super.haddock.override { + Cabal = null; + }; }; }; in packages { @@ -229,27 +233,38 @@ ghcWrapperPackage = import ../development/compilers/ghcjs/wrapper.nix; prefFun = self : super : super // { # This is the list of packages that are built into a booted ghcjs installation -# Cabal_1_19_2 = null; -# Cabal = self.Cabal_1_19_2; - Cabal = packages_ghc782.CabalGhcjs; - aeson_0_7_0_4 = null; - aeson = self.aeson_0_7_0_4; + # It can be generated with the command: + # nix-shell '' -A pkgs.haskellPackages_ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/-\(.\)/\U\1/' | sed 's/^\([^_]*\)\(.*\)$/\1\2 = null;\n\1 = self.\1\2;/'" + Cabal_1_21_0_0 = null; + Cabal = self.Cabal_1_21_0_0; + aeson_0_8_0_0 = null; + aeson = self.aeson_0_8_0_0; array_0_5_0_0 = null; array = self.array_0_5_0_0; - attoparsec_0_11_3_1 = null; - attoparsec = self.attoparsec_0_11_3_1; - base_4_7_0_0 = null; - base = self.base_4_7_0_0; - bytestring_0_10_4_0 = null; - bytestring = self.bytestring_0_10_4_0; + async_2_0_1_5 = null; + async = self.async_2_0_1_5; + attoparsec_0_12_1_0 = null; + attoparsec = self.attoparsec_0_12_1_0; + base_4_7_0_1 = null; + base = self.base_4_7_0_1; + binary_0_7_2_1 = null; + binary = self.binary_0_7_2_1; + rts_1_0 = null; + rts = self.rts_1_0; + # bytestring_0_10_4_1 = null; + # bytestring = self.bytestring_0_10_4_1; + caseInsensitive_1_2_0_0 = null; + caseInsensitive = self.caseInsensitive_1_2_0_0; containers_0_5_5_1 = null; containers = self.containers_0_5_5_1; deepseq_1_3_0_2 = null; deepseq = self.deepseq_1_3_0_2; directory_1_2_1_0 = null; directory = self.directory_1_2_1_0; - dlist_0_7_1 = null; - dlist = self.dlist_0_7_1; + dlist_0_7_0_1 = null; + dlist = self.dlist_0_7_0_1; + extensibleExceptions_0_1_1_3 = null; + extensibleExceptions = self.extensibleExceptions_0_1_1_3; filepath_1_3_0_2 = null; filepath = self.filepath_1_3_0_2; ghcPrim_0_3_1_0 = null; @@ -258,42 +273,75 @@ ghcjsBase = self.ghcjsBase_0_1_0_0; ghcjsPrim_0_1_0_0 = null; ghcjsPrim = self.ghcjsPrim_0_1_0_0; - hashable_1_2_1_0 = null; - hashable = self.hashable_1_2_1_0; + hashable_1_2_2_0 = null; + hashable = self.hashable_1_2_2_0; integerGmp_0_5_1_0 = null; integerGmp = self.integerGmp_0_5_1_0; - mtl_2_1_3_1 = null; - mtl = self.mtl_2_1_3_1; + mtl_2_2_1 = null; + mtl = self.mtl_2_2_1; oldLocale_1_0_0_6 = null; oldLocale = self.oldLocale_1_0_0_6; + oldTime_1_1_0_2 = null; + oldTime = self.oldTime_1_1_0_2; + parallel_3_2_0_4 = null; + parallel = self.parallel_3_2_0_4; pretty_1_1_1_1 = null; pretty = self.pretty_1_1_1_1; primitive_0_5_3_0 = null; primitive = self.primitive_0_5_3_0; - # process_1_2_0_0 = null; - # process = self.process_1_2_0_0; - scientific_0_2_0_2 = null; - scientific = self.scientific_0_2_0_2; + process_1_2_0_0 = null; + process = self.process_1_2_0_0; + scientific_0_3_3_0 = null; + scientific = self.scientific_0_3_3_0; + stm_2_4_3 = null; + stm = self.stm_2_4_3; syb_0_4_2 = null; syb = self.syb_0_4_2; - templateHaskell_2_9_0_0 = null; - templateHaskell = self.templateHaskell_2_9_0_0; + # templateHaskell_2_9_0_0 = null; + # templateHaskell = self.templateHaskell_2_9_0_0; text_1_1_1_3 = null; text = self.text_1_1_1_3; time_1_4_2 = null; time = self.time_1_4_2; - transformers_0_3_0_0 = null; - transformers = self.transformers_0_3_0_0; + transformers_0_4_1_0 = null; + transformers = self.transformers_0_4_1_0; unix_2_7_0_1 = null; unix = self.unix_2_7_0_1; unorderedContainers_0_2_5_0 = null; unorderedContainers = self.unorderedContainers_0_2_5_0; vector_0_10_11_0 = null; vector = self.vector_0_10_11_0; - # These are necessary for compatibility with ghcjs's default libs - transformersCompat = self.transformersCompat_0_3_3; - oldTime = self.oldTime_1_1_0_2; - process = self.process_1_2_0_0; # ghcjs-boot seems to install process incorrectly, for some reason, so reinstall it + + # This is necessary because haskell-packages will refuse to generate tfRandom for this version of ghc (0.1.0) + #TODO: haskell-packages shouldn't use the ghcjs version as the ghc version + tfRandom = self.callPackage ../development/libraries/haskell/tf-random {}; + +/* + buildLocalCabalWithArgs = { src, name, args ? {}, cabalDrvArgs ? { jailbreak = true; }, cabal2nix ? packages_ghc782.cabal2nix }: let + cabalExpr = pkgs.stdenv.mkDerivation ({ + name = "${name}.nix"; + + buildCommand = '' + ${cabal2nix}/bin/cabal2nix ${src + "/${name}.cabal"} --sha256=FILTERME \ + | grep -v FILTERME | sed \ + -e 's/licenses.proprietary/licenses.unfree/' \ + -e 's/{ cabal/{ cabal, cabalInstall, cabalDrvArgs ? {}, src/' \ + -e 's/cabal.mkDerivation (self: {/cabal.mkDerivation (self: cabalDrvArgs \/\/ {/' \ + -e 's/buildDepends = \[/buildDepends = \[ cabalInstall/' \ + -e 's/pname = \([^\n]*\)/pname = \1\n inherit src;\n/' > $out + ''; + + } // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux { + LANG = "en_US.UTF-8"; + LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; + }); + in self.callPackage cabalExpr ({ inherit src cabalDrvArgs; } // args); +*/ + }; + extension = self: super: { + buildLocalCabalWithArgs = args: super.buildLocalCabalWithArgs (args // { + cabal2nix = packages_ghc782.cabal2nix; + }); }; }; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index f0f561c9c96..4ca039d0d67 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -847,7 +847,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in Cabal = self.Cabal_1_18_1_3; }; - ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-codemirror {}; + ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-dom {}; ghcjsCodemirror = callPackage ../development/libraries/haskell/ghcjs-codemirror {}; @@ -1342,7 +1342,9 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in lazysmallcheck = callPackage ../development/libraries/haskell/lazysmallcheck {}; - lens = callPackage ../development/libraries/haskell/lens {}; + lens_4_2 = callPackage ../development/libraries/haskell/lens/4.2.nix {}; + lens_4_4 = callPackage ../development/libraries/haskell/lens/4.4.nix {}; + lens = self.lens_4_4; lensDatetime = callPackage ../development/libraries/haskell/lens-datetime {}; @@ -2328,6 +2330,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in transformersBase = callPackage ../development/libraries/haskell/transformers-base {}; transformersCompat_0_3_3 = callPackage ../development/libraries/haskell/transformers-compat/0.3.3.nix {}; + transformersCompat_0_3_3_3 = callPackage ../development/libraries/haskell/transformers-compat/0.3.3.3.nix {}; transformersCompat_0_3_3_4 = callPackage ../development/libraries/haskell/transformers-compat/0.3.3.4.nix {}; transformersCompat = self.transformersCompat_0_3_3_4; @@ -2788,12 +2791,12 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in cabal2nix = callPackage ../development/tools/haskell/cabal2nix {}; # Build a cabal package given a local .cabal file - buildLocalCabalWithArgs = { src, name, args ? {}, cabalDrvArgs ? { jailbreak = true; } }: let + buildLocalCabalWithArgs = { src, name, args ? {}, cabalDrvArgs ? { jailbreak = true; }, cabal2nix }: let cabalExpr = pkgs.stdenv.mkDerivation ({ name = "${name}.nix"; buildCommand = '' - ${self.cabal2nix}/bin/cabal2nix ${src + "/${name}.cabal"} --sha256=FILTERME \ + ${cabal2nix}/bin/cabal2nix ${src + "/${name}.cabal"} --sha256=FILTERME \ | grep -v FILTERME | sed \ -e 's/licenses.proprietary/licenses.unfree/' \ -e 's/{ cabal/{ cabal, cabalInstall, cabalDrvArgs ? {}, src/' \ From a5e6027ece5786f406622179ccceb43c7e83457a Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Sun, 24 Aug 2014 16:27:44 -0400 Subject: [PATCH 9/9] Get rid of debugging output. --- pkgs/build-support/cabal/ghcjs.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/build-support/cabal/ghcjs.nix b/pkgs/build-support/cabal/ghcjs.nix index df356b6ac99..d74c30180e2 100644 --- a/pkgs/build-support/cabal/ghcjs.nix +++ b/pkgs/build-support/cabal/ghcjs.nix @@ -20,7 +20,7 @@ let filter = stdenv.lib.filter; in -builtins.trace (ghc.parent.CabalGhcjs.version or null) { +{ mkDerivation = args : # arguments for the individual package, can modify the defaults let # These attributes are removed in the end. This is in order not to spoil the build @@ -162,7 +162,6 @@ builtins.trace (ghc.parent.CabalGhcjs.version or null) { # compiles Setup and configures configurePhase = '' - set -x eval "$preConfigure" ${optionalString self.jailbreak "${ghc.ghc.parent.jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}