From c41675bce0ce3eb4d79180c804892e8e3c268e55 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Sat, 12 May 2018 01:06:47 -0400 Subject: [PATCH 01/11] GHCJS 8.2 --- .../compilers/ghcjs-ng/8.2/dep-overrides.nix | 6 + .../compilers/ghcjs-ng/8.2/git.json | 6 + .../compilers/ghcjs-ng/8.2/stage0.nix | 168 ++++++++++++++++++ pkgs/development/compilers/ghcjs-ng/README.md | 20 +++ .../compilers/ghcjs-ng/common-overrides.nix | 8 + .../ghcjs-ng/configured-ghcjs-src.nix | 44 +++++ .../compilers/ghcjs-ng/default.nix | 77 ++++++++ .../compilers/ghcjs-ng/mk-stage0.nix | 25 +++ pkgs/top-level/haskell-packages.nix | 28 ++- 9 files changed, 377 insertions(+), 5 deletions(-) create mode 100644 pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix create mode 100644 pkgs/development/compilers/ghcjs-ng/8.2/git.json create mode 100644 pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix create mode 100644 pkgs/development/compilers/ghcjs-ng/README.md create mode 100644 pkgs/development/compilers/ghcjs-ng/common-overrides.nix create mode 100644 pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix create mode 100644 pkgs/development/compilers/ghcjs-ng/default.nix create mode 100644 pkgs/development/compilers/ghcjs-ng/mk-stage0.nix diff --git a/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix b/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix new file mode 100644 index 00000000000..72066ee1701 --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix @@ -0,0 +1,6 @@ +{ haskellLib }: + +let inherit (haskellLib) dontHaddock; +in self: super: { + ghcjs = dontHaddock super.ghcjs; +} diff --git a/pkgs/development/compilers/ghcjs-ng/8.2/git.json b/pkgs/development/compilers/ghcjs-ng/8.2/git.json new file mode 100644 index 00000000000..efe7794a103 --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/8.2/git.json @@ -0,0 +1,6 @@ +{ + "url": "https://github.com/ghcjs/ghcjs", + "rev": "0cff73c3ee13b464adba90f308b77751c75b9f26", + "sha256": "1shg34zi6ryaihar62qdkkalv8dsrsqbv58jzkhk9in38sdfkjxv", + "fetchSubmodules": true +} diff --git a/pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix b/pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix new file mode 100644 index 00000000000..0680ff156e1 --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix @@ -0,0 +1,168 @@ +{ callPackage, configuredSrc }: + +{ + + ghcjs = callPackage + ({ mkDerivation, aeson, array, attoparsec, base, base16-bytestring + , base64-bytestring, binary, bytestring, Cabal, containers + , cryptohash, data-default, deepseq, directory, executable-path + , filepath, ghc-api-ghcjs, ghc-boot, ghc-paths, ghci-ghcjs + , ghcjs-th, haddock-api-ghcjs, hashable, haskell-src-exts + , haskell-src-meta, http-types, HUnit, lens, lifted-base, mtl + , network, optparse-applicative, parallel, parsec, process, random + , regex-posix, safe, shelly, split, stdenv, stringsearch, syb + , system-fileio, system-filepath, tar, template-haskell + , template-haskell-ghcjs, terminfo, test-framework + , test-framework-hunit, text, time, transformers + , transformers-compat, unix, unix-compat, unordered-containers + , vector, wai, wai-app-static, wai-extra, wai-websockets, warp + , webdriver, websockets, wl-pprint-text, yaml + }: + mkDerivation { + pname = "ghcjs"; + version = "8.2.0.1"; + src = configuredSrc + /.; + isLibrary = true; + isExecutable = true; + enableSeparateDataOutput = true; + setupHaskellDepends = [ + base Cabal containers directory filepath process template-haskell + transformers + ]; + libraryHaskellDepends = [ + aeson array attoparsec base base16-bytestring base64-bytestring + binary bytestring Cabal containers cryptohash data-default deepseq + directory filepath ghc-api-ghcjs ghc-boot ghc-paths ghci-ghcjs + ghcjs-th hashable haskell-src-exts haskell-src-meta lens mtl + optparse-applicative parallel parsec process regex-posix safe split + stringsearch syb template-haskell template-haskell-ghcjs text time + transformers unordered-containers vector wl-pprint-text yaml + ]; + executableHaskellDepends = [ + aeson base binary bytestring Cabal containers directory + executable-path filepath ghc-api-ghcjs ghc-boot haddock-api-ghcjs + lens mtl optparse-applicative process shelly system-fileio + system-filepath tar terminfo text time transformers + transformers-compat unix unix-compat unordered-containers vector + yaml + ]; + testHaskellDepends = [ + aeson base bytestring data-default deepseq directory http-types + HUnit lens lifted-base network optparse-applicative process random + shelly system-fileio system-filepath test-framework + test-framework-hunit text time transformers unordered-containers + wai wai-app-static wai-extra wai-websockets warp webdriver + websockets yaml + ]; + description = "Haskell to JavaScript compiler"; + license = stdenv.lib.licenses.mit; + }) {}; + + ghc-api-ghcjs = callPackage + ({ mkDerivation, array, base, binary, bytestring, containers + , deepseq, directory, filepath, ghc-boot, ghc-boot-th, ghci-ghcjs + , hoopl, hpc, process, stdenv, template-haskell-ghcjs, terminfo + , time, transformers, unix + }: + mkDerivation { + pname = "ghc-api-ghcjs"; + version = "8.2.2"; + src = configuredSrc + /lib/ghc-api-ghcjs; + libraryHaskellDepends = [ + array base binary bytestring containers deepseq directory filepath + ghc-boot ghc-boot-th ghci-ghcjs hoopl hpc process + template-haskell-ghcjs terminfo time transformers unix + ]; + homepage = "http://www.haskell.org/ghc/"; + description = "The GHC API (customized for GHCJS)"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + ghci-ghcjs = callPackage + ({ mkDerivation, array, base, binary, bytestring, containers + , deepseq, filepath, ghc-boot, ghc-boot-th, stdenv + , template-haskell-ghcjs, transformers, unix + }: + mkDerivation { + pname = "ghci-ghcjs"; + version = "8.2.2"; + src = configuredSrc + /lib/ghci-ghcjs; + libraryHaskellDepends = [ + array base binary bytestring containers deepseq filepath ghc-boot + ghc-boot-th template-haskell-ghcjs transformers unix + ]; + description = "The library supporting GHC's interactive interpreter (customized for GHCJS)"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + ghcjs-th = callPackage + ({ mkDerivation, base, binary, bytestring, containers, ghc-prim + , ghci-ghcjs, stdenv, template-haskell-ghcjs + }: + mkDerivation { + pname = "ghcjs-th"; + version = "0.1.0.0"; + src = configuredSrc + /lib/ghcjs-th; + libraryHaskellDepends = [ + base binary bytestring containers ghc-prim ghci-ghcjs + template-haskell-ghcjs + ]; + homepage = "http://github.com/ghcjs"; + license = stdenv.lib.licenses.mit; + }) {}; + + haddock-api-ghcjs = callPackage + ({ mkDerivation, array, base, bytestring, Cabal, containers, deepseq + , directory, filepath, ghc-api-ghcjs, ghc-boot, ghc-paths + , haddock-library-ghcjs, hspec, hspec-discover, QuickCheck, stdenv + , transformers, xhtml + }: + mkDerivation { + pname = "haddock-api-ghcjs"; + version = "2.18.1"; + src = configuredSrc + /lib/haddock-api-ghcjs; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + array base bytestring Cabal containers deepseq directory filepath + ghc-api-ghcjs ghc-boot ghc-paths haddock-library-ghcjs transformers + xhtml + ]; + testHaskellDepends = [ + base containers ghc-api-ghcjs hspec QuickCheck + ]; + testToolDepends = [ hspec-discover ]; + homepage = "http://www.haskell.org/haddock/"; + description = "A documentation-generation tool for Haskell libraries (customized for GHCJS)"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + haddock-library-ghcjs = callPackage + ({ mkDerivation, base, base-compat, bytestring, deepseq, hspec + , hspec-discover, QuickCheck, stdenv, transformers + }: + mkDerivation { + pname = "haddock-library-ghcjs"; + version = "1.4.4"; + src = configuredSrc + /lib/haddock-library-ghcjs; + libraryHaskellDepends = [ base bytestring deepseq transformers ]; + testHaskellDepends = [ + base base-compat bytestring deepseq hspec QuickCheck transformers + ]; + testToolDepends = [ hspec-discover ]; + homepage = "http://www.haskell.org/haddock/"; + description = "Library exposing some functionality of Haddock"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + template-haskell-ghcjs = callPackage + ({ mkDerivation, base, ghc-boot-th, pretty, stdenv }: + mkDerivation { + pname = "template-haskell-ghcjs"; + version = "2.12.0.0"; + src = configuredSrc + /lib/template-haskell-ghcjs; + libraryHaskellDepends = [ base ghc-boot-th pretty ]; + description = "Support library for Template Haskell (customized for GHCJS)"; + license = stdenv.lib.licenses.bsd3; + }) {}; + +} diff --git a/pkgs/development/compilers/ghcjs-ng/README.md b/pkgs/development/compilers/ghcjs-ng/README.md new file mode 100644 index 00000000000..3e1598c83b0 --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/README.md @@ -0,0 +1,20 @@ +New build system for GHCJS 8.2 +--- + +`ghcjs-8.2` reworked the build system, and now comes with its own +small package set of dependencies. This involves autogenerating +several sources and cabal files, based on a GHC +checkout. `callCabal2nix` is off limits, since we don't like "import +from derivation" in nixpkgs. So there is a derivation that builds the +nix expression that should be checked in whenever GHCJS is updated. + +Updating +--- + +``` +$ nix-prefetch-git https://github.com/ghcjs/ghcjs --rev refs/heads/ghc-8.2 \ + | jq '{ url, rev, fetchSubmodules, sha256 }' \ + > 8.2/git.json +$ cat $(nix-build ../../../.. -A haskell.compiler.ghcjs82.genStage0 --no-out-link) > 8.2/stage0.nix +``` + diff --git a/pkgs/development/compilers/ghcjs-ng/common-overrides.nix b/pkgs/development/compilers/ghcjs-ng/common-overrides.nix new file mode 100644 index 00000000000..172a48a5a65 --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/common-overrides.nix @@ -0,0 +1,8 @@ +{ haskellLib, alex, happy }: + +let inherit (haskellLib) addBuildTools appendConfigureFlag dontHaddock doJailbreak; +in self: super: { + ghc-api-ghcjs = addBuildTools super.ghc-api-ghcjs [alex happy]; + ghcjs = appendConfigureFlag (doJailbreak super.ghcjs) "-fno-wrapper-install"; + haddock-library-ghcjs = dontHaddock super.haddock-library-ghcjs; +} diff --git a/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix new file mode 100644 index 00000000000..b9435b31157 --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix @@ -0,0 +1,44 @@ +{ perl +, autoconf +, automake +, python3 +, gcc +, cabal-install +, gmp +, runCommand + +, ghc +, happy +, alex + +, ghcjsSrc +}: + +runCommand "configured-ghcjs-src" { + buildInputs = [ + perl + autoconf + automake + python3 + ghc + happy + alex + cabal-install + ]; + inherit ghcjsSrc; +} '' + export HOME=$(pwd) + cp -r "$ghcjsSrc" "$out" + chmod -R +w "$out" + cd "$out" + + # TODO: Find a better way to avoid impure version numbers + sed -i 's/RELEASE=NO/RELEASE=YES/' ghc/configure.ac + + # TODO: How to actually fix this? + # Seems to work fine and produce the right files. + touch ghc/includes/ghcautoconf.h + + patchShebangs . + ./utils/makePackages.sh copy +'' diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix new file mode 100644 index 00000000000..c2fb6a03c6b --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -0,0 +1,77 @@ +{ stdenv +, callPackage +, fetchgit +, ghcjsSrcJson ? null +, ghcjsSrc ? fetchgit (builtins.fromJSON (builtins.readFile ghcjsSrcJson)) +, bootPkgs +, alex +, happy +, stage0 +, haskellLib +, cabal-install +, nodejs +, makeWrapper +, xorg +, gmp +, lib +, ghcjsDepOverrides ? (_:_:{}) +}: + +let + passthru = { + configuredSrc = callPackage ./configured-ghcjs-src.nix { + inherit ghcjsSrc alex happy; + inherit (bootPkgs) ghc; + }; + genStage0 = callPackage ./mk-stage0.nix { inherit (passthru) configuredSrc; }; + bootPkgs = bootPkgs.extend (lib.foldr lib.composeExtensions (_:_:{}) [ + (self: _: import stage0 { + inherit (passthru) configuredSrc; + inherit (self) callPackage; + }) + + (callPackage ./common-overrides.nix { inherit haskellLib alex happy; }) + ghcjsDepOverrides + ]); + + targetPrefix = ""; + inherit (passthru.bootPkgs.ghcjs) version; + isGhcjs = true; + + # Relics of the old GHCJS build system + stage1Packages = []; + mkStage2 = _: {}; + }; + + libexec = + if builtins.compareVersions passthru.bootPkgs.ghcjs.version "8.3" <= 0 + then "${passthru.bootPkgs.ghcjs}/bin" + else "${passthru.bootPkgs.ghcjs}/libexec/${stdenv.system}-${passthru.bootPkgs.ghc.name}/${passthru.bootPkgs.ghcjs.name}"; + +in stdenv.mkDerivation { + name = "ghcjs"; + src = passthru.configuredSrc; + nativeBuildInputs = [passthru.bootPkgs.ghcjs passthru.bootPkgs.ghc cabal-install nodejs makeWrapper xorg.lndir gmp]; + phases = ["unpackPhase" "buildPhase"]; + buildPhase = '' + export HOME=$TMP + cd lib/boot + + mkdir -p $out/bin + mkdir -p $out/libexec + lndir ${libexec} $out/bin + + wrapProgram $out/bin/ghcjs --add-flags "-B$out/libexec" + wrapProgram $out/bin/haddock-ghcjs --add-flags "-B$out/libexec" + wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/libexec/package.conf.d" + + env PATH=$out/bin:$PATH $out/bin/ghcjs-boot -j $NIX_BUILD_CORES --with-ghcjs-bin $out/bin + ''; + + enableParallelBuilding = true; + + inherit passthru; + + meta.platforms = passthru.bootPkgs.ghc.meta.platforms; + } + diff --git a/pkgs/development/compilers/ghcjs-ng/mk-stage0.nix b/pkgs/development/compilers/ghcjs-ng/mk-stage0.nix new file mode 100644 index 00000000000..f45ebb4511d --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/mk-stage0.nix @@ -0,0 +1,25 @@ +{ configuredSrc +, runCommand +, cabal2nix +, yq +}: + +runCommand "stage0.nix" { + buildInputs = [cabal2nix yq]; +} '' + ( + printf '{ callPackage, configuredSrc }:\n\n{\n\n' + yq '.packages | .[]' ${configuredSrc}/stack.yaml -r | sed 's|^\.$|./.|' | sed 's|^\.||' | while read f; do + printf ' %s = callPackage\n' \ + "$(find ${configuredSrc}/$f -name "*.cabal" -maxdepth 1 \ + | xargs basename \ + | sed 's/.cabal$//')" + printf '(%s) {};' \ + "$(cabal2nix ${configuredSrc}/$f \ + | sed 's|${configuredSrc}/|configuredSrc + |g')" \ + | sed 's/^/ /' + printf '\n\n' + done + printf '}\n' + ) > $out +'' diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 8a395fbec18..837f8eb794d 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -10,7 +10,10 @@ let "ghc821Binary" "ghcCross" "ghcjs" - "ghcjsHEAD" + "ghcjs710" + "ghcjs80" + "ghcjs82" + "ghcjs84" "integer-simple" ]; @@ -76,14 +79,22 @@ in rec { buildLlvmPackages = buildPackages.llvmPackages_5; llvmPackages = pkgs.llvmPackages_5; }; - ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs { + ghcjs = compiler.ghcjs82; + ghcjs710 = packages.ghc7103.callPackage ../development/compilers/ghcjs { bootPkgs = packages.ghc7103; inherit (pkgs) cabal-install; }; - ghcjsHEAD = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix { + ghcjs80 = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix { bootPkgs = packages.ghc802; inherit (pkgs) cabal-install; }; + ghcjs82 = callPackage ../development/compilers/ghcjs-ng rec { + bootPkgs = packages.ghc822; + inherit (bootPkgs) alex happy; + ghcjsSrcJson = ../development/compilers/ghcjs-ng/8.2/git.json; + stage0 = ../development/compilers/ghcjs-ng/8.2/stage0.nix; + ghcjsDepOverrides = callPackage ../development/compilers/ghcjs-ng/8.2/dep-overrides.nix {}; + }; # The integer-simple attribute set contains all the GHC compilers # build with integer-simple instead of integer-gmp. @@ -139,18 +150,25 @@ in rec { ghc = bh.compiler.ghcHEAD; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { }; }; - ghcjs = callPackage ../development/haskell-modules rec { + ghcjs = packages.ghcjs82; + ghcjs710 = callPackage ../development/haskell-modules rec { buildHaskellPackages = ghc.bootPkgs; ghc = bh.compiler.ghcjs; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { }; packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; }; - ghcjsHEAD = callPackage ../development/haskell-modules rec { + ghcjs80 = callPackage ../development/haskell-modules rec { buildHaskellPackages = ghc.bootPkgs; ghc = bh.compiler.ghcjsHEAD; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { }; packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; }; + ghcjs82 = callPackage ../development/haskell-modules rec { + buildHaskellPackages = ghc.bootPkgs; + ghc = bh.compiler.ghcjs82; + compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { }; + packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; + }; # The integer-simple attribute set contains package sets for all the GHC compilers # using integer-simple instead of integer-gmp. From 64df9b6b899fc734577f9b832f17ba3286db1634 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Sat, 12 May 2018 17:11:41 -0400 Subject: [PATCH 02/11] GHCJS 8.4 --- .../compilers/ghcjs-ng/8.4/dep-overrides.nix | 7 + .../compilers/ghcjs-ng/8.4/git.json | 6 + .../compilers/ghcjs-ng/8.4/stage0.nix | 175 ++++++++++++++++++ .../configuration-ghc-8.4.x.nix | 5 +- pkgs/top-level/haskell-packages.nix | 13 ++ 5 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/compilers/ghcjs-ng/8.4/dep-overrides.nix create mode 100644 pkgs/development/compilers/ghcjs-ng/8.4/git.json create mode 100644 pkgs/development/compilers/ghcjs-ng/8.4/stage0.nix diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/dep-overrides.nix b/pkgs/development/compilers/ghcjs-ng/8.4/dep-overrides.nix new file mode 100644 index 00000000000..2d0ed55c6cd --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/8.4/dep-overrides.nix @@ -0,0 +1,7 @@ +{ haskellLib }: + +let inherit (haskellLib) dontCheck doJailbreak; +in self: super: { + haddock-library-ghcjs = dontCheck super.haddock-library-ghcjs; + haddock-api-ghcjs = doJailbreak super.haddock-api-ghcjs; +} diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/git.json b/pkgs/development/compilers/ghcjs-ng/8.4/git.json new file mode 100644 index 00000000000..2d4a7a42667 --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/8.4/git.json @@ -0,0 +1,6 @@ +{ + "url": "https://github.com/ghcjs/ghcjs", + "rev": "c494a598d1e5b6d70ddcb97177dc4b6cc71f5bd0", + "sha256": "1gpn1y3m2gk2x4anfh11p4cp49blabj761wicawvkw0w9bfhcfhn", + "fetchSubmodules": true +} diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/stage0.nix b/pkgs/development/compilers/ghcjs-ng/8.4/stage0.nix new file mode 100644 index 00000000000..051b0a19b5b --- /dev/null +++ b/pkgs/development/compilers/ghcjs-ng/8.4/stage0.nix @@ -0,0 +1,175 @@ +{ callPackage, configuredSrc }: + +{ + + ghcjs = callPackage + ({ mkDerivation, aeson, array, attoparsec, base, base16-bytestring + , base64-bytestring, binary, bytestring, Cabal, containers + , cryptohash, data-default, deepseq, directory, executable-path + , filepath, ghc-api-ghcjs, ghc-boot, ghc-paths, ghci-ghcjs + , ghcjs-th, haddock-api-ghcjs, hashable, haskell-src-exts + , haskell-src-meta, http-types, HUnit, lens, lifted-base, mtl + , network, optparse-applicative, parallel, parsec, process, random + , regex-posix, safe, shelly, split, stdenv, stringsearch, syb + , system-fileio, system-filepath, tar, template-haskell + , template-haskell-ghcjs, terminfo, test-framework + , test-framework-hunit, text, time, transformers + , transformers-compat, unix, unix-compat, unordered-containers + , vector, wai, wai-app-static, wai-extra, wai-websockets, warp + , webdriver, websockets, wl-pprint-text, yaml + }: + mkDerivation { + pname = "ghcjs"; + version = "8.4.0.1"; + src = configuredSrc + /.; + isLibrary = true; + isExecutable = true; + enableSeparateDataOutput = true; + setupHaskellDepends = [ + base Cabal containers directory filepath process template-haskell + transformers + ]; + libraryHaskellDepends = [ + aeson array attoparsec base base16-bytestring base64-bytestring + binary bytestring Cabal containers cryptohash data-default deepseq + directory filepath ghc-api-ghcjs ghc-boot ghc-paths ghci-ghcjs + ghcjs-th hashable haskell-src-exts haskell-src-meta lens mtl + optparse-applicative parallel parsec process regex-posix safe split + stringsearch syb template-haskell template-haskell-ghcjs text time + transformers unordered-containers vector wl-pprint-text yaml + ]; + executableHaskellDepends = [ + aeson base binary bytestring Cabal containers directory + executable-path filepath ghc-api-ghcjs ghc-boot haddock-api-ghcjs + lens mtl optparse-applicative process shelly system-fileio + system-filepath tar terminfo text time transformers + transformers-compat unix unix-compat unordered-containers vector + yaml + ]; + testHaskellDepends = [ + aeson base bytestring data-default deepseq directory http-types + HUnit lens lifted-base network optparse-applicative process random + shelly system-fileio system-filepath test-framework + test-framework-hunit text time transformers unordered-containers + wai wai-app-static wai-extra wai-websockets warp webdriver + websockets yaml + ]; + description = "Haskell to JavaScript compiler"; + license = stdenv.lib.licenses.mit; + }) {}; + + ghc-api-ghcjs = callPackage + ({ mkDerivation, array, base, binary, bytestring, containers + , deepseq, directory, filepath, ghc-boot, ghc-boot-th, ghci-ghcjs + , hpc, process, stdenv, template-haskell-ghcjs, terminfo, time + , transformers, unix + }: + mkDerivation { + pname = "ghc-api-ghcjs"; + version = "8.4.0"; + src = configuredSrc + /lib/ghc-api-ghcjs; + libraryHaskellDepends = [ + array base binary bytestring containers deepseq directory filepath + ghc-boot ghc-boot-th ghci-ghcjs hpc process template-haskell-ghcjs + terminfo time transformers unix + ]; + homepage = "http://www.haskell.org/ghc/"; + description = "The GHC API (customized for GHCJS)"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + ghci-ghcjs = callPackage + ({ mkDerivation, array, base, binary, bytestring, containers + , deepseq, filepath, ghc-boot, ghc-boot-th, stdenv + , template-haskell-ghcjs, transformers, unix + }: + mkDerivation { + pname = "ghci-ghcjs"; + version = "8.4.0"; + src = configuredSrc + /lib/ghci-ghcjs; + libraryHaskellDepends = [ + array base binary bytestring containers deepseq filepath ghc-boot + ghc-boot-th template-haskell-ghcjs transformers unix + ]; + description = "The library supporting GHC's interactive interpreter (customized for GHCJS)"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + ghcjs-th = callPackage + ({ mkDerivation, base, binary, bytestring, containers, ghc-prim + , ghci-ghcjs, stdenv, template-haskell-ghcjs + }: + mkDerivation { + pname = "ghcjs-th"; + version = "0.1.0.0"; + src = configuredSrc + /lib/ghcjs-th; + libraryHaskellDepends = [ + base binary bytestring containers ghc-prim ghci-ghcjs + template-haskell-ghcjs + ]; + homepage = "http://github.com/ghcjs"; + license = stdenv.lib.licenses.mit; + }) {}; + + haddock-api-ghcjs = callPackage + ({ mkDerivation, array, base, bytestring, Cabal, containers, deepseq + , directory, filepath, ghc-api-ghcjs, ghc-boot, ghc-paths + , haddock-library-ghcjs, hspec, hspec-discover, QuickCheck, stdenv + , transformers, xhtml + }: + mkDerivation { + pname = "haddock-api-ghcjs"; + version = "2.20.0"; + src = configuredSrc + /lib/haddock-api-ghcjs; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + array base bytestring Cabal containers deepseq directory filepath + ghc-api-ghcjs ghc-boot ghc-paths haddock-library-ghcjs transformers + xhtml + ]; + testHaskellDepends = [ + array base bytestring Cabal containers deepseq directory filepath + ghc-api-ghcjs ghc-boot ghc-paths haddock-library-ghcjs hspec + QuickCheck transformers xhtml + ]; + testToolDepends = [ hspec-discover ]; + homepage = "http://www.haskell.org/haddock/"; + description = "A documentation-generation tool for Haskell libraries"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + haddock-library-ghcjs = callPackage + ({ mkDerivation, base, base-compat, bytestring, containers, deepseq + , directory, filepath, haddock-library, hspec, hspec-discover + , optparse-applicative, QuickCheck, stdenv, transformers, tree-diff + }: + mkDerivation { + pname = "haddock-library-ghcjs"; + version = "1.6.0"; + src = configuredSrc + /lib/haddock-library-ghcjs; + libraryHaskellDepends = [ + base bytestring containers deepseq transformers + ]; + testHaskellDepends = [ + base base-compat bytestring containers deepseq directory filepath + haddock-library hspec optparse-applicative QuickCheck transformers + tree-diff + ]; + testToolDepends = [ hspec-discover ]; + homepage = "http://www.haskell.org/haddock/"; + description = "Library exposing some functionality of Haddock"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + template-haskell-ghcjs = callPackage + ({ mkDerivation, base, ghc-boot-th, pretty, stdenv }: + mkDerivation { + pname = "template-haskell-ghcjs"; + version = "2.13.0.0"; + src = configuredSrc + /lib/template-haskell-ghcjs; + libraryHaskellDepends = [ base ghc-boot-th pretty ]; + description = "Support library for Template Haskell (customized for GHCJS)"; + license = stdenv.lib.licenses.bsd3; + }) {}; + +} diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix index 70624d1ed6a..12fd5974830 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix @@ -105,6 +105,9 @@ self: super: { ## hspec-discover ==2.4.8 hspec-discover = super.hspec-discover_2_5_0; + # https://github.com/jcristovao/enclosed-exceptions/issues/12 + enclosed-exceptions = dontCheck super.enclosed-exceptions; + ## On Hackage: ## Upstreamed, awaiting a Hackage release @@ -450,7 +453,7 @@ self: super: { matrix = self.matrix_0_3_6_1; pandoc = self.pandoc_2_2; pandoc-types = self.pandoc-types_1_17_4_2; - wl-pprint-text = self.wl-pprint-text_1_1_1_1; + wl-pprint-text = self.wl-pprint-text_1_2_0_0; base-compat = self.base-compat_0_10_1; # https://github.com/xmonad/xmonad/issues/155 diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 837f8eb794d..c00bce430c3 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -95,6 +95,13 @@ in rec { stage0 = ../development/compilers/ghcjs-ng/8.2/stage0.nix; ghcjsDepOverrides = callPackage ../development/compilers/ghcjs-ng/8.2/dep-overrides.nix {}; }; + ghcjs84 = callPackage ../development/compilers/ghcjs-ng rec { + bootPkgs = packages.ghc842; + inherit (bootPkgs) alex happy; + ghcjsSrcJson = ../development/compilers/ghcjs-ng/8.4/git.json; + stage0 = ../development/compilers/ghcjs-ng/8.4/stage0.nix; + ghcjsDepOverrides = callPackage ../development/compilers/ghcjs-ng/8.4/dep-overrides.nix {}; + }; # The integer-simple attribute set contains all the GHC compilers # build with integer-simple instead of integer-gmp. @@ -169,6 +176,12 @@ in rec { compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { }; packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; }; + ghcjs84 = callPackage ../development/haskell-modules rec { + buildHaskellPackages = ghc.bootPkgs; + ghc = bh.compiler.ghcjs84; + compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.4.x.nix { }; + packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; + }; # The integer-simple attribute set contains package sets for all the GHC compilers # using integer-simple instead of integer-gmp. From d86edd5161c28f59291c23594de5e9002a1a03b6 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Wed, 16 May 2018 03:09:22 -0400 Subject: [PATCH 03/11] Dont haddock ghcjs in either version --- pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix | 6 ------ pkgs/development/compilers/ghcjs-ng/common-overrides.nix | 2 +- pkgs/top-level/haskell-packages.nix | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix diff --git a/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix b/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix deleted file mode 100644 index 72066ee1701..00000000000 --- a/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ haskellLib }: - -let inherit (haskellLib) dontHaddock; -in self: super: { - ghcjs = dontHaddock super.ghcjs; -} diff --git a/pkgs/development/compilers/ghcjs-ng/common-overrides.nix b/pkgs/development/compilers/ghcjs-ng/common-overrides.nix index 172a48a5a65..a88e2c48d03 100644 --- a/pkgs/development/compilers/ghcjs-ng/common-overrides.nix +++ b/pkgs/development/compilers/ghcjs-ng/common-overrides.nix @@ -3,6 +3,6 @@ let inherit (haskellLib) addBuildTools appendConfigureFlag dontHaddock doJailbreak; in self: super: { ghc-api-ghcjs = addBuildTools super.ghc-api-ghcjs [alex happy]; - ghcjs = appendConfigureFlag (doJailbreak super.ghcjs) "-fno-wrapper-install"; + ghcjs = dontHaddock (appendConfigureFlag (doJailbreak super.ghcjs) "-fno-wrapper-install"); haddock-library-ghcjs = dontHaddock super.haddock-library-ghcjs; } diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index c00bce430c3..2e6bd5ebb85 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -93,7 +93,6 @@ in rec { inherit (bootPkgs) alex happy; ghcjsSrcJson = ../development/compilers/ghcjs-ng/8.2/git.json; stage0 = ../development/compilers/ghcjs-ng/8.2/stage0.nix; - ghcjsDepOverrides = callPackage ../development/compilers/ghcjs-ng/8.2/dep-overrides.nix {}; }; ghcjs84 = callPackage ../development/compilers/ghcjs-ng rec { bootPkgs = packages.ghc842; From 0f850499615ff2327bf5fd16b85b3c75d56edac7 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Wed, 16 May 2018 03:09:40 -0400 Subject: [PATCH 04/11] bump ghcjs 8.4 --- pkgs/development/compilers/ghcjs-ng/8.4/git.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/git.json b/pkgs/development/compilers/ghcjs-ng/8.4/git.json index 2d4a7a42667..49ff19529c6 100644 --- a/pkgs/development/compilers/ghcjs-ng/8.4/git.json +++ b/pkgs/development/compilers/ghcjs-ng/8.4/git.json @@ -1,6 +1,6 @@ { "url": "https://github.com/ghcjs/ghcjs", - "rev": "c494a598d1e5b6d70ddcb97177dc4b6cc71f5bd0", - "sha256": "1gpn1y3m2gk2x4anfh11p4cp49blabj761wicawvkw0w9bfhcfhn", + "rev": "6770fa38621f55b7a947fc11c69f81b8ce8502cf", + "sha256": "0c0x0yylx14mrvzmbvkw6zbprriizk73hvz8iija8i8hwpff79vm", "fetchSubmodules": true } From 9326126fdd73ef910441553a815fe300bbfe4d37 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Wed, 16 May 2018 03:09:54 -0400 Subject: [PATCH 05/11] Add gcc to configured-ghcjs-src for macos --- pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix index b9435b31157..e8c24b21134 100644 --- a/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix +++ b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix @@ -20,6 +20,7 @@ runCommand "configured-ghcjs-src" { autoconf automake python3 + gcc ghc happy alex From 2a32834ad9ff1d44efdf3a24a3182ddc8eeea2ed Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Wed, 16 May 2018 03:10:52 -0400 Subject: [PATCH 06/11] Factor out bootGhcjs for justStaticExecutables sake --- .../compilers/ghcjs-ng/default.nix | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix index c2fb6a03c6b..71bab1a4e66 100644 --- a/pkgs/development/compilers/ghcjs-ng/default.nix +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -35,7 +35,7 @@ let ]); targetPrefix = ""; - inherit (passthru.bootPkgs.ghcjs) version; + inherit (bootGhcjs) version; isGhcjs = true; # Relics of the old GHCJS build system @@ -43,15 +43,24 @@ let mkStage2 = _: {}; }; + bootGhcjs = haskellLib.justStaticExecutables passthru.bootPkgs.ghcjs; libexec = - if builtins.compareVersions passthru.bootPkgs.ghcjs.version "8.3" <= 0 - then "${passthru.bootPkgs.ghcjs}/bin" - else "${passthru.bootPkgs.ghcjs}/libexec/${stdenv.system}-${passthru.bootPkgs.ghc.name}/${passthru.bootPkgs.ghcjs.name}"; + if builtins.compareVersions bootGhcjs.version "8.3" <= 0 + then "${bootGhcjs}/bin" + else "${bootGhcjs}/libexec/${stdenv.system}-${passthru.bootPkgs.ghc.name}/${bootGhcjs.name}"; in stdenv.mkDerivation { name = "ghcjs"; src = passthru.configuredSrc; - nativeBuildInputs = [passthru.bootPkgs.ghcjs passthru.bootPkgs.ghc cabal-install nodejs makeWrapper xorg.lndir gmp]; + nativeBuildInputs = [ + bootGhcjs + passthru.bootPkgs.ghc + cabal-install + nodejs + makeWrapper + xorg.lndir + gmp + ]; phases = ["unpackPhase" "buildPhase"]; buildPhase = '' export HOME=$TMP @@ -61,7 +70,7 @@ in stdenv.mkDerivation { mkdir -p $out/libexec lndir ${libexec} $out/bin - wrapProgram $out/bin/ghcjs --add-flags "-B$out/libexec" + wrapProgram $out/bin/ghcjs --add-flags "-B$out/libexec -dcore-lint" wrapProgram $out/bin/haddock-ghcjs --add-flags "-B$out/libexec" wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/libexec/package.conf.d" From 2f6c9947fe5d5ac1d1832337267eb735a7832161 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 17 May 2018 05:26:48 -0400 Subject: [PATCH 07/11] Add pkgconfig to ghcjs boot --- pkgs/development/compilers/ghcjs-ng/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix index 71bab1a4e66..03bdf022ecd 100644 --- a/pkgs/development/compilers/ghcjs-ng/default.nix +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -13,6 +13,7 @@ , makeWrapper , xorg , gmp +, pkgconfig , lib , ghcjsDepOverrides ? (_:_:{}) }: @@ -60,6 +61,7 @@ in stdenv.mkDerivation { makeWrapper xorg.lndir gmp + pkgconfig ]; phases = ["unpackPhase" "buildPhase"]; buildPhase = '' From 9c6e63ffdac0579b118e3bef5b436fbefb0e0978 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 17 May 2018 05:27:03 -0400 Subject: [PATCH 08/11] Expose bootGhcjs for convenience's sake --- pkgs/development/compilers/ghcjs-ng/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix index 03bdf022ecd..a5d0c46e78e 100644 --- a/pkgs/development/compilers/ghcjs-ng/default.nix +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -36,6 +36,7 @@ let ]); targetPrefix = ""; + inherit bootGhcjs; inherit (bootGhcjs) version; isGhcjs = true; From 7b405d35648ac198c1329063d6e3bc820356482c Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 17 May 2018 05:27:19 -0400 Subject: [PATCH 09/11] Remove -dcore-lint from GHCJS wrapper --- pkgs/development/compilers/ghcjs-ng/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix index a5d0c46e78e..785f5b878f7 100644 --- a/pkgs/development/compilers/ghcjs-ng/default.nix +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -73,7 +73,7 @@ in stdenv.mkDerivation { mkdir -p $out/libexec lndir ${libexec} $out/bin - wrapProgram $out/bin/ghcjs --add-flags "-B$out/libexec -dcore-lint" + wrapProgram $out/bin/ghcjs --add-flags "-B$out/libexec" wrapProgram $out/bin/haddock-ghcjs --add-flags "-B$out/libexec" wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/libexec/package.conf.d" From 4eb49533cbbab3994b0819de966501d994e8b688 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 17 May 2018 05:27:38 -0400 Subject: [PATCH 10/11] Work around GHCJS bug with ghcjs-boot -j1 --- pkgs/development/compilers/ghcjs-ng/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix index 785f5b878f7..035687a64f3 100644 --- a/pkgs/development/compilers/ghcjs-ng/default.nix +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -77,10 +77,12 @@ in stdenv.mkDerivation { wrapProgram $out/bin/haddock-ghcjs --add-flags "-B$out/libexec" wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/libexec/package.conf.d" - env PATH=$out/bin:$PATH $out/bin/ghcjs-boot -j $NIX_BUILD_CORES --with-ghcjs-bin $out/bin + env PATH=$out/bin:$PATH $out/bin/ghcjs-boot -j1 --with-ghcjs-bin $out/bin ''; - enableParallelBuilding = true; + # We hard code -j1 as a temporary workaround for + # https://github.com/ghcjs/ghcjs/issues/654 + # enableParallelBuilding = true; inherit passthru; From 2dd3789d47da95988cea74ff213a7e990c9e3a79 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 17 May 2018 05:35:00 -0400 Subject: [PATCH 11/11] Bump GHCJS 8.4 --- pkgs/development/compilers/ghcjs-ng/8.4/git.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/git.json b/pkgs/development/compilers/ghcjs-ng/8.4/git.json index 49ff19529c6..b27c75bfe71 100644 --- a/pkgs/development/compilers/ghcjs-ng/8.4/git.json +++ b/pkgs/development/compilers/ghcjs-ng/8.4/git.json @@ -1,6 +1,6 @@ { "url": "https://github.com/ghcjs/ghcjs", - "rev": "6770fa38621f55b7a947fc11c69f81b8ce8502cf", - "sha256": "0c0x0yylx14mrvzmbvkw6zbprriizk73hvz8iija8i8hwpff79vm", + "rev": "d20da90a4819faad1c6309a06363b34edac0374c", + "sha256": "0jmxgfm1zwg6xscjcaycfam7zss8ik4ql4ii5lpryh4h6cdhvkbr", "fetchSubmodules": true }