diff --git a/default.nix b/default.nix index f624865f9..66112032b 100644 --- a/default.nix +++ b/default.nix @@ -113,6 +113,8 @@ let iosSupport = system == "x86_64-darwin"; inherit (nixpkgs) lib fetchurl fetchgit fetchgitPrivate fetchFromGitHub fetchFromBitbucket; + wasmCross = nixpkgs.hackGet ./wasm-cross; + webGhcSrc = (import (wasmCross + /webghc.nix) { inherit fetchgit; }).ghc865SplicesSrc; nixpkgsCross = { android = lib.mapAttrs (_: args: nixpkgsFunc (nixpkgsArgs // args)) rec { aarch64 = { @@ -149,6 +151,9 @@ let iosSupport = system == "x86_64-darwin"; ghcjs = nixpkgsFunc (nixpkgsArgs // { crossSystem = lib.systems.examples.ghcjs; }); + wasm = nixpkgsFunc (nixpkgsArgs // + (import wasmCross { inherit nixpkgsFunc; }).nixpkgsCrossArgs webGhcSrc "8.6.5" + ); }; haskellLib = nixpkgs.haskell.lib; @@ -205,6 +210,14 @@ let iosSupport = system == "x86_64-darwin"; overrides = nixpkgsCross.ghcjs.haskell.overlays.combined; }; + wasm = ghcWasm32-8_6; + ghcWasm32-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable (nixpkgsCross.wasm.haskell.packages.ghcWasm.override (old: { + # Due to the splices changes the parallel build fails while building the libraries + ghc = old.ghc.overrideAttrs (drv: { enableParallelBuilding = false; }); + }))).override { + overrides = nixpkgsCross.wasm.haskell.overlays.combined; + }); + ghc = ghc8_6; ghcHEAD = (makeRecursivelyOverridable nixpkgs.haskell.packages.ghcHEAD).override { overrides = nixpkgs.haskell.overlays.combined; @@ -299,6 +312,8 @@ in let this = rec { iosAarch32 iosAarch64 iosWithHaskellPackages + wasm + wasmCross ; # Back compat diff --git a/haskell-overlays/default.nix b/haskell-overlays/default.nix index fd277885a..454167ce8 100644 --- a/haskell-overlays/default.nix +++ b/haskell-overlays/default.nix @@ -10,6 +10,7 @@ let inherit (nixpkgs.buildPackages) thunkSet runCommand fetchgit fetchFromGitHub fetchFromBitbucket; + inherit (nixpkgs) hackGet; in rec { @@ -53,6 +54,7 @@ rec { (optionalExtension (nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt or false) android) (optionalExtension (nixpkgs.stdenv.hostPlatform.isiOS or false) ios) + (optionalExtension (nixpkgs.stdenv.hostPlatform.isWasm or false) wasm) user-custom-post ] self super; @@ -85,7 +87,7 @@ rec { reflexPackages = import ./reflex-packages { inherit - haskellLib lib nixpkgs thunkSet fetchFromGitHub fetchFromBitbucket + haskellLib lib nixpkgs thunkSet fetchFromGitHub fetchFromBitbucket hackGet useFastWeak useReflexOptimizer enableTraceReflexEvents enableLibraryProfiling __useTemplateHaskell ; }; @@ -156,6 +158,8 @@ rec { inherit thunkSet; }; + wasm = import ./wasm; + user-custom-pre = foldExtensions haskellOverlaysPre; user-custom-post = foldExtensions haskellOverlaysPost; } diff --git a/haskell-overlays/reflex-packages/default.nix b/haskell-overlays/reflex-packages/default.nix index 7662e2366..5815ed081 100644 --- a/haskell-overlays/reflex-packages/default.nix +++ b/haskell-overlays/reflex-packages/default.nix @@ -1,6 +1,6 @@ { haskellLib , lib, nixpkgs -, thunkSet, fetchFromGitHub, fetchFromBitbucket +, thunkSet, fetchFromGitHub, fetchFromBitbucket, hackGet , useFastWeak, useReflexOptimizer, enableTraceReflexEvents, enableLibraryProfiling, __useTemplateHaskell }: @@ -13,6 +13,7 @@ let reflexDomRepo = self._dep.reflex-dom; jsaddleSrc = self._dep.jsaddle; gargoylePkgs = self.callPackage self._dep.gargoyle self; + wasmCross = hackGet ../../wasm-cross; reflexOptimizerFlag = lib.optional (useReflexOptimizer && (self.ghc.cross or null) == null) "-fuse-reflex-optimizer"; useTemplateHaskellFlag = lib.optional (!__useTemplateHaskell) "-f-use-template-haskell"; @@ -86,8 +87,11 @@ in ])) {}) (drv: { # Hack until https://github.com/NixOS/cabal2nix/pull/432 lands - libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ stdenv.lib.optionals (with stdenv.hostPlatform; isAndroid && is32bit) [ + libraryHaskellDepends = (drv.libraryHaskellDepends or []) + ++ stdenv.lib.optionals (with stdenv.hostPlatform; isAndroid && is32bit) [ self.android-activity + ] ++ stdenv.lib.optionals (with stdenv.hostPlatform; isWasm && is32bit) [ + self.jsaddle-wasm ]; }); @@ -129,6 +133,7 @@ in jsaddle-warp = dontCheck (self.callCabal2nix "jsaddle-warp" (jsaddleSrc + /jsaddle-warp) {}); jsaddle-dom = self.callCabal2nix "jsaddle-dom" self._dep.jsaddle-dom {}; + jsaddle-wasm = self.callCabal2nix "jsaddle-wasm" (hackGet (wasmCross + /jsaddle-wasm)) {}; ghcjs-dom = self.callCabal2nix "ghcjs-dom" (self._dep.ghcjs-dom + "/ghcjs-dom") {}; ghcjs-dom-jsaddle = self.callCabal2nix "ghcjs-dom-jsaddle" (self._dep.ghcjs-dom + "/ghcjs-dom-jsaddle") {}; ghcjs-dom-jsffi = self.callCabal2nix "ghcjs-dom-jsffi" (self._dep.ghcjs-dom + "/ghcjs-dom-jsffi") {}; diff --git a/haskell-overlays/reflex-packages/dep/reflex-dom/github.json b/haskell-overlays/reflex-packages/dep/reflex-dom/github.json index eadc5c799..1813952d8 100644 --- a/haskell-overlays/reflex-packages/dep/reflex-dom/github.json +++ b/haskell-overlays/reflex-packages/dep/reflex-dom/github.json @@ -1,7 +1,7 @@ { "owner": "reflex-frp", "repo": "reflex-dom", - "branch": "master", - "rev": "94c26076a71f229b5bd27128cf6fc0dbcba011ac", - "sha256": "00sx5x51jv1j24qlhrbp5sqnqcyz1iy2sgjap0y97c4dkzxi3wd3" + "branch": "develop", + "rev": "e2b846037badee035d0c466173badd1c4c474d5a", + "sha256": "12vj25zzg2xr6mvyw83skr24y30swmg79kmg7lizy3klwpv5dysc" } diff --git a/haskell-overlays/wasm/default.nix b/haskell-overlays/wasm/default.nix new file mode 100644 index 000000000..843f530ab --- /dev/null +++ b/haskell-overlays/wasm/default.nix @@ -0,0 +1,16 @@ +self: super: { + jsaddle-warp = null; + jsaddle-webkitgtk = null; + jsaddle-webkit2gtk = null; + jsaddle-wkwebview = null; + mkDerivation = args: super.mkDerivation (args // { + dontStrip = true; + enableSharedExecutables = false; + enableSharedLibraries = false; + enableDeadCodeElimination = false; + doHaddock = false; + doCheck = false; + enableLibraryProfiling = false; + }); +} + diff --git a/nixpkgs/github.json b/nixpkgs/github.json index f38046a6f..3e03f244b 100644 --- a/nixpkgs/github.json +++ b/nixpkgs/github.json @@ -1,7 +1,7 @@ { - "owner": "nixos", + "owner": "WebGHC", "repo": "nixpkgs", - "branch": "release-19.09", - "rev": "49550f29cd9d6ed27f4a76ba3c3fe30edf882eb7", - "sha256": "003fpkrcc5mw33q670q4z865zpr430cllbxhyzj8k9p4hbc8yqda" + "branch": "wasm-r-p-1909-integ", + "rev": "423fa4adb6276298cde0c12205efeb7bf1cbe805", + "sha256": "0ssvc5j0p7nip0qsrdbfgc6wihzwyxa23hbr80dmjbfizywz7nzg" } diff --git a/wasm-cross/default.nix b/wasm-cross/default.nix new file mode 100644 index 000000000..0cf822e33 --- /dev/null +++ b/wasm-cross/default.nix @@ -0,0 +1,8 @@ +# DO NOT HAND-EDIT THIS FILE +let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }: + if !fetchSubmodules && !private then builtins.fetchTarball { + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; + } else (import {}).fetchFromGitHub { + inherit owner repo rev sha256 fetchSubmodules private; + }; +in import (fetch (builtins.fromJSON (builtins.readFile ./github.json))) diff --git a/wasm-cross/github.json b/wasm-cross/github.json new file mode 100644 index 000000000..cc70cfe4b --- /dev/null +++ b/wasm-cross/github.json @@ -0,0 +1,8 @@ +{ + "owner": "WebGHC", + "repo": "wasm-cross", + "branch": "reflex-platform-integ", + "private": false, + "rev": "98dbc945147ed646724682a2a4f470bc592a5501", + "sha256": "1vnxmxx262h6r0lslidd0fnnrsjz88jfx1dj7v66vl0pjdz7icb4" +}