|
5 | 5 | , useWebkit2Gtk |
6 | 6 | }: |
7 | 7 |
|
8 | | -with haskellLib; |
| 8 | +with haskellLib.compose; |
9 | 9 |
|
10 | 10 | self: super: |
11 | 11 |
|
12 | 12 | let |
13 | | - universeRepo = self._dep.universe; |
14 | | - reflexDomRepo = self._dep.reflex-dom; |
15 | | - jsaddleSrc = self._dep.jsaddle; |
16 | | - gargoyleSrc = self._dep.gargoyle; |
17 | | - wasmCross = hackGet ../../wasm-cross; |
18 | | - |
19 | 13 | reflexOptimizerFlag = lib.optional (useReflexOptimizer && (self.ghc.cross or null) == null) "-fuse-reflex-optimizer"; |
20 | 14 | useTemplateHaskellFlag = lib.optional (!__useTemplateHaskell) "-f-use-template-haskell"; |
21 | 15 | useWebkit2GtkFlag = if useWebkit2Gtk |
22 | 16 | then ["-fwebkit2gtk"] |
23 | 17 | else ["-f-webkit2gtk"] ++ lib.optional ((nixpkgs.stdenv.hostPlatform.isLinux or false) && !nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt) "-fuse-warp"; # Enable warp on linux if webkit2gtk is disabled. Other platforms have other default runners |
24 | 18 |
|
25 | | - inherit (nixpkgs) stdenv; |
26 | | - # Older chromium for reflex-dom-core test suite |
27 | | - nixpkgs_oldChromium = import ../../nixpkgs-old-chromium { |
28 | | - inherit (nixpkgs.stdenv.buildPlatform) system; |
29 | | - overlays = [ (self: super: { |
30 | | - # Disable tests for p11-kit, a dependency of chromium |
31 | | - # They fail on non-NixOS systems |
32 | | - # https://github.com/NixOS/nixpkgs/issues/96715 |
33 | | - p11-kit = super.p11-kit.overrideAttrs (oldAttrs: { |
34 | | - doCheck = false; |
35 | | - }); |
36 | | - })]; |
37 | | - }; |
38 | 19 | in |
39 | 20 | { |
40 | 21 | _dep = super._dep or {} // thunkSet ./dep; |
|
43 | 24 | ## Reflex family |
44 | 25 | ## |
45 | 26 |
|
46 | | - reflex = self.callCabal2nixWithOptions "reflex" self._dep.reflex (lib.concatStringsSep " " (lib.concatLists [ |
47 | | - (lib.optional enableTraceReflexEvents "-fdebug-trace-events") |
48 | | - reflexOptimizerFlag |
49 | | - useTemplateHaskellFlag |
50 | | - (lib.optional useFastWeak "-ffast-weak") |
51 | | - ])) {}; |
52 | | - |
53 | | - reflex-todomvc = |
54 | | - let |
55 | | - flags = |
56 | | - if useWebkit2Gtk && nixpkgs.stdenv.hostPlatform.isLinux |
57 | | - then [ "-f-warp" "-f-webkitgtk" "-f-wkwebview" ] |
58 | | - else if (nixpkgs.stdenv.hostPlatform.isLinux && !nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt) |
59 | | - then [ "-fwarp" "-f-webkitgtk" "-f-wkwebview" "-f-webkit2gtk" ] |
60 | | - else if self.ghc.stdenv.targetPlatform.isiOS |
61 | | - then [ "-f-webkit2gtk" "-f-warp" "-f-webkitgtk" ] |
62 | | - else if nixpkgs.stdenv.hostPlatform.isDarwin |
63 | | - then [ "-fwkwebview" "-f-webkit2gtk" "-f-webkitgtk" ] |
64 | | - else []; |
65 | | - in |
66 | | - (haskellLib.doJailbreak (self.callCabal2nixWithOptions "reflex-todomvc" self._dep.reflex-todomvc (lib.concatStringsSep " " flags) {})); |
67 | | - reflex-aeson-orphans = self.callCabal2nix "reflex-aeson-orphans" self._dep.reflex-aeson-orphans {}; |
68 | | - |
69 | | - # The tests for reflex-dom-core are not deterministic, disable them, and run them manually |
70 | | - reflex-dom-core = let |
71 | | - inherit (self) ghc; |
72 | | - noGcTest = stdenv.hostPlatform.system != "x86_64-linux" |
73 | | - || stdenv.hostPlatform != stdenv.buildPlatform |
74 | | - || stdenv.targetPlatform.isiOS |
75 | | - || (ghc.isGhcjs or false); |
76 | | - in haskellLib.overrideCabal |
77 | | - (self.callCabal2nixWithOptions "reflex-dom-core" (reflexDomRepo + "/reflex-dom-core") (lib.concatStringsSep " " (lib.concatLists [ |
78 | | - reflexOptimizerFlag |
79 | | - useTemplateHaskellFlag |
80 | | - (lib.optional enableLibraryProfiling "-fprofile-reflex") |
81 | | - [ "-f-hydration-tests" ] |
82 | | - [ "-f-gc-tests" ] |
83 | | - ])) {}) |
84 | | - (drv: { |
85 | | - # TODO: Get hlint working for cross-compilation |
86 | | - #doCheck = stdenv.hostPlatform == stdenv.buildPlatform && !(ghc.isGhcjs or false); |
87 | | - doCheck = false; |
88 | | - # The headless browser run as part of the tests will exit without this |
89 | | - preBuild = (drv.preBuild or "") + '' |
90 | | - export HOME="$PWD" |
91 | | - ''; |
92 | | - |
93 | | - # Show some output while running tests, so we might notice what's wrong |
94 | | - testTarget = "--show-details=streaming"; |
95 | | - |
96 | | - testHaskellDepends = with self; (drv.testHaskellDepends or []) ++ lib.optionals (!noGcTest) [ |
97 | | - temporary |
98 | | - jsaddle-warp |
99 | | - process |
100 | | - chrome-test-utils |
101 | | - ]; |
102 | | - |
103 | | - testSystemDepends = with nixpkgs; (drv.testSystemDepends or []) ++ lib.optionals (nixpkgs.stdenv.hostPlatform.isLinux) [ |
104 | | - nixpkgs_oldChromium.selenium-server-standalone |
105 | | - nixpkgs_oldChromium.chromium |
106 | | - which |
107 | | - ] ++ lib.optionals (!noGcTest) [ |
108 | | - nixpkgs.iproute2 |
109 | | - ]; |
110 | | - } // lib.optionalAttrs (!noGcTest) { |
111 | | - # The headless browser run as part of gc tests would hang/crash without this |
112 | | - preCheck = '' |
113 | | - export FONTCONFIG_PATH=${nixpkgs.fontconfig.out}/etc/fonts |
114 | | - '' + (drv.preCheck or ""); |
115 | | - }); |
116 | | - |
117 | | - reflex-dom = haskellLib.doJailbreak (haskellLib.overrideCabal (self.callCabal2nixWithOptions "reflex-dom" (reflexDomRepo + "/reflex-dom") (lib.concatStringsSep " " (lib.concatLists [ |
118 | | - reflexOptimizerFlag |
119 | | - useTemplateHaskellFlag |
120 | | - useWebkit2GtkFlag |
121 | | - ])) { }) (drv: { |
122 | | - preConfigure = (drv.preConfigure or "") + '' |
123 | | - sed -i 's|aeson >=1.4 && <1.6|aeson -any|g' *.cabal |
124 | | - ''; |
125 | | - |
126 | | - libraryHaskellDepends = [ |
127 | | - self.reflex |
128 | | - self.reflex-dom-core |
129 | | - self.aeson |
130 | | - ] ++ lib.optional (nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt or false) self.android-activity |
131 | | - ++ lib.optional (nixpkgs.stdenv.hostPlatform.isDarwin or false) self.jsaddle-wkwebview |
132 | | - ++ lib.optional ((nixpkgs.stdenv.hostPlatform.isLinux or false) && !nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt) self.jsaddle-warp; |
133 | | - })); |
134 | | - |
135 | | - chrome-test-utils = self.callCabal2nix "chrome-test-utils" (reflexDomRepo + "/chrome-test-utils") {}; |
136 | | - |
137 | | - ## |
138 | | - ## Terminal / Conventional OS |
139 | | - ## |
140 | | - |
141 | | - reflex-vty = haskellLib.doJailbreak (self.callCabal2nix "reflex-vty" self._dep.reflex-vty {}); |
142 | | - reflex-process = self.callCabal2nix "reflex-process" self._dep.reflex-process {}; |
143 | | - reflex-fsnotify = self.callCabal2nix "reflex-fsnotify" self._dep.reflex-fsnotify {}; |
144 | | - |
145 | | - ## |
146 | | - ## Tooling |
147 | | - ## |
148 | | - |
149 | | - reflex-ghci = dontCheck (self.callCabal2nix "reflex-ghci" self._dep.reflex-ghci {}); |
150 | | - |
151 | | - ## |
152 | | - ## GHCJS and JSaddle |
153 | | - ## |
154 | | - |
155 | | - jsaddle = doJailbreak (self.callCabal2nix "jsaddle" (jsaddleSrc + "/jsaddle") {}); |
156 | | - jsaddle-clib = self.callCabal2nix "jsaddle-clib" (jsaddleSrc + "/jsaddle-clib") {}; |
157 | | - jsaddle-webkit2gtk = overrideCabal (self.callCabal2nix "jsaddle-webkit2gtk" (jsaddleSrc + "/jsaddle-webkit2gtk") {}) (drv: { |
158 | | - preConfigure = "substituteInPlace jsaddle-webkit2gtk.cabal --replace 'aeson >=0.8.0.2 && <2.1' aeson"; |
159 | | - }); |
160 | | - jsaddle-webkitgtk = self.callCabal2nix "jsaddle-webkitgtk" (jsaddleSrc + "/jsaddle-webkitgtk") {}; |
161 | | - jsaddle-wkwebview = overrideCabal (self.callCabal2nix "jsaddle-wkwebview" (jsaddleSrc + "/jsaddle-wkwebview") {}) (drv: { |
162 | | - preConfigure = "substituteInPlace jsaddle-wkwebview.cabal --replace 'aeson >=0.8.0.2 && <2.1' aeson"; |
163 | | - libraryFrameworkDepends = (drv.libraryFrameworkDepends or []) ++ |
164 | | - (if nixpkgs.stdenv.hostPlatform.useiOSPrebuilt then [ |
165 | | - "${nixpkgs.buildPackages.darwin.xcode}/Contents/Developer/Platforms/${nixpkgs.stdenv.hostPlatform.xcodePlatform}.platform/Developer/SDKs/${nixpkgs.stdenv.hostPlatform.xcodePlatform}.sdk/System" |
166 | | - ] else (with nixpkgs.buildPackages.darwin.apple_sdk.frameworks; [ Cocoa WebKit ])); |
167 | | - buildDepends = lib.optional (!nixpkgs.stdenv.hostPlatform.useiOSPrebuilt) [ nixpkgs.buildPackages.darwin.cf-private ]; |
168 | | - }); |
169 | | - |
170 | | - # another broken test |
171 | | - # phantomjs has issues with finding the right port |
172 | | - # jsaddle-warp = dontCheck (addTestToolDepend (self.callCabal2nix "jsaddle-warp" "${jsaddleSrc}/jsaddle-warp" {})); |
173 | | - jsaddle-warp = overrideCabal (dontCheck (self.callCabal2nix "jsaddle-warp" (jsaddleSrc + "/jsaddle-warp") {})) (derv: { |
174 | | - preConfigure = "substituteInPlace jsaddle-warp.cabal --replace 'aeson >=0.8.0.2 && <2.1' aeson"; |
175 | | - }); |
176 | | - |
177 | | - jsaddle-dom = doJailbreak (self.callCabal2nix "jsaddle-dom" self._dep.jsaddle-dom {}); |
178 | | - jsaddle-wasm = self.callCabal2nix "jsaddle-wasm" (hackGet (wasmCross + "/jsaddle-wasm")) {}; |
179 | | - ghcjs-dom = self.callCabal2nix "ghcjs-dom" (self._dep.ghcjs-dom + "/ghcjs-dom") {}; |
180 | | - ghcjs-dom-jsaddle = self.callCabal2nix "ghcjs-dom-jsaddle" (self._dep.ghcjs-dom + "/ghcjs-dom-jsaddle") {}; |
181 | | - ghcjs-dom-jsffi = self.callCabal2nix "ghcjs-dom-jsffi" (self._dep.ghcjs-dom + "/ghcjs-dom-jsffi") {}; |
182 | | - |
183 | | - ## |
184 | | - ## Gargoyle and dependencies |
185 | | - ## |
186 | | - |
187 | | - gargoyle = self.callCabal2nixWithOptions "gargoyle" gargoyleSrc "--subpath gargoyle" {}; |
188 | | - gargoyle-postgresql = haskellLib.overrideCabal |
189 | | - (self.callCabal2nixWithOptions "gargoyle-postgresql" gargoyleSrc "--subpath gargoyle-postgresql" {}) |
190 | | - (drv: { |
191 | | - testSystemDepends = (drv.testSystemDepends or []) ++ [ nixpkgs.postgresql_10 ]; |
192 | | - }); |
193 | | - gargoyle-postgresql-nix = haskellLib.overrideCabal |
194 | | - (self.callCabal2nixWithOptions "gargoyle-postgresql-nix" gargoyleSrc "--subpath gargoyle-postgresql-nix" {}) |
195 | | - (drv: { |
196 | | - librarySystemDepends = (drv.librarySystemDepends or []) ++ [ nixpkgs.postgresql_10 ]; |
197 | | - }); |
198 | | - gargoyle-postgresql-connect = self.callCabal2nixWithOptions "gargoyle-postgresql-connect" gargoyleSrc "--subpath gargoyle-postgresql-connect" {}; |
199 | | - which = self.callHackage "which" "0.2" {}; |
200 | | - |
201 | | - ## |
202 | | - ## Misc other dependencies |
203 | | - ## |
204 | | - |
205 | | - haskell-gi-overloading = dontHaddock (self.callHackage "haskell-gi-overloading" "0.0" {}); |
206 | | - monoidal-containers = self.callHackage "monoidal-containers" "0.6.3.0" {}; |
207 | | - patch = self.callCabal2nix "patch" self._dep.patch {}; |
208 | | - commutative-semigroups = self.callCabal2nix "commutative-semigroups" self._dep.commutative-semigroups {}; |
209 | | - witherable = self.callHackage "witherable" "0.4.2" {}; |
210 | | - |
211 | | - webdriver = markUnbroken (self.callHackage "webdriver" "0.9.0.1" {}); |
212 | | - |
213 | | - # Not on Hackage yet |
214 | | - # Version 1.2.1 not on Hackage yet |
215 | | - hspec-webdriver = self.callCabal2nix "hspec-webdriver" (fetchFromGitHub { |
216 | | - owner = "dfordivam"; |
217 | | - repo = "hspec-webdriver-clone"; |
218 | | - rev = "0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8"; |
219 | | - sha256 = "1criynifhvmnqwhrshmzylikqkvlgq98xf72w9cdd2zpjw539qf0"; |
220 | | - }) {}; |
221 | | - |
222 | | - constraints-extras = self.callCabal2nix "constraints-extras" (hackGet ./dep/constraints-extras) {}; |
223 | | - some = self.callHackage "some" "1.0.4" {}; |
224 | | - prim-uniq = self.callHackage "prim-uniq" "0.2" {}; |
225 | | - aeson-gadt-th = self.callHackage "aeson-gadt-th" "0.2.5.1" {}; |
226 | | - dependent-map = self.callCabal2nix "dependent-map" (hackGet ./dep/dependent-map) {}; |
227 | | - dependent-monoidal-map = self.callCabal2nix "dependent-monoidal-map" self._dep.dependent-monoidal-map {}; |
228 | | - dependent-sum = self.callCabal2nix "dependent-sum" self._dep.dependent-sum {}; |
229 | | - dependent-sum-template = self.callCabal2nix "dependent-sum-template" self._dep.dependent-sum-template {}; |
230 | | - dependent-sum-universe-orphans = self.callCabal2nix "dependent-sum-universe-orphans" self._dep.dependent-sum-universe-orphans {}; |
231 | | - dependent-sum-aeson-orphans = self.callCabal2nix "dependent-sum-aeson-orphans" self._dep.dependent-sum-aeson-orphans {}; |
232 | | - |
233 | | - # Need to use `--subpath` because LICENSE in each dir is a symlink to the repo root. |
234 | | - universe = self.callCabal2nixWithOptions "universe" universeRepo "--subpath universe" {}; |
235 | | - universe-base = self.callCabal2nixWithOptions "universe" universeRepo "--subpath universe-base" {}; |
236 | | - universe-dependent-sum = nixpkgs.haskell.lib.doJailbreak (self.callCabal2nixWithOptions "universe" universeRepo "--subpath universe-dependent-sum" {}); |
237 | | - universe-instances-extended = self.callCabal2nixWithOptions "universe" universeRepo "--subpath universe-instances-extended" {}; |
238 | | - universe-reverse-instances = self.callCabal2nixWithOptions "universe" universeRepo "--subpath universe-reverse-instances" {}; |
239 | | - universe-instances-base = self.callCabal2nixWithOptions "universe" universeRepo "--subpath deprecated/universe-instances-base" {}; |
240 | | - |
241 | | - th-abstraction = self.callHackage "th-abstraction" "0.4.3.0" {}; |
242 | | - |
243 | | - vessel = self.callCabal2nix "vessel" self._dep.vessel {}; |
244 | | - |
245 | | - # Slightly newer version to fix |
246 | | - # https://github.com/danfran/cabal-macosx/issues/13 |
247 | | - cabal-macosx = self.callHackage "cabal-macosx" "0.2.4.2" {}; |
248 | | -} |
| 27 | + #reflex = self.callCabal2nixWithOptions "reflex" self._dep.reflex (lib.concatStringsSep " " (lib.concatLists [ |
| 28 | + # (lib.optional enableTraceReflexEvents "-fdebug-trace-events") |
| 29 | + # reflexOptimizerFlag |
| 30 | + # useTemplateHaskellFlag |
| 31 | + # (lib.optional useFastWeak "-ffast-weak") |
| 32 | + #])) {}; |
| 33 | + |
| 34 | + #reflex-todomvc = |
| 35 | + # let |
| 36 | + # flags = |
| 37 | + # if useWebkit2Gtk && nixpkgs.stdenv.hostPlatform.isLinux |
| 38 | + # then [ "-f-warp" "-f-webkitgtk" "-f-wkwebview" ] |
| 39 | + # else if (nixpkgs.stdenv.hostPlatform.isLinux && !nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt) |
| 40 | + # then [ "-fwarp" "-f-webkitgtk" "-f-wkwebview" "-f-webkit2gtk" ] |
| 41 | + # else if self.ghc.stdenv.targetPlatform.isiOS |
| 42 | + # then [ "-f-webkit2gtk" "-f-warp" "-f-webkitgtk" ] |
| 43 | + # else if nixpkgs.stdenv.hostPlatform.isDarwin |
| 44 | + # then [ "-fwkwebview" "-f-webkit2gtk" "-f-webkitgtk" ] |
| 45 | + # else []; |
| 46 | + # in |
| 47 | + # (haskellLib.doJailbreak (self.callCabal2nixWithOptions "reflex-todomvc" self._dep.reflex-todomvc (lib.concatStringsSep " " flags) {})); |
| 48 | + #reflex-aeson-orphans = self.callCabal2nix "reflex-aeson-orphans" self._dep.reflex-aeson-orphans {}; |
| 49 | + |
| 50 | + ## The tests for reflex-dom-core are not deterministic, disable them, and run them manually |
| 51 | + #reflex-dom-core = let |
| 52 | + # inherit (self) ghc; |
| 53 | + # noGcTest = stdenv.hostPlatform.system != "x86_64-linux" |
| 54 | + # || stdenv.hostPlatform != stdenv.buildPlatform |
| 55 | + # || stdenv.targetPlatform.isiOS |
| 56 | + # || (ghc.isGhcjs or false); |
| 57 | + #in haskellLib.overrideCabal |
| 58 | + # (self.callCabal2nixWithOptions "reflex-dom-core" (reflexDomRepo + "/reflex-dom-core") (lib.concatStringsSep " " (lib.concatLists [ |
| 59 | + # reflexOptimizerFlag |
| 60 | + # useTemplateHaskellFlag |
| 61 | + # (lib.optional enableLibraryProfiling "-fprofile-reflex") |
| 62 | + # [ "-f-hydration-tests" ] |
| 63 | + # [ "-f-gc-tests" ] |
| 64 | + # ])) {}) |
| 65 | + # (drv: { |
| 66 | + # # TODO: Get hlint working for cross-compilation |
| 67 | + # #doCheck = stdenv.hostPlatform == stdenv.buildPlatform && !(ghc.isGhcjs or false); |
| 68 | + # doCheck = false; |
| 69 | + # # The headless browser run as part of the tests will exit without this |
| 70 | + # preBuild = (drv.preBuild or "") + '' |
| 71 | + # export HOME="$PWD" |
| 72 | + # ''; |
| 73 | + |
| 74 | + # # Show some output while running tests, so we might notice what's wrong |
| 75 | + # testTarget = "--show-details=streaming"; |
| 76 | + |
| 77 | + # testHaskellDepends = with self; (drv.testHaskellDepends or []) ++ lib.optionals (!noGcTest) [ |
| 78 | + # temporary |
| 79 | + # jsaddle-warp |
| 80 | + # process |
| 81 | + # chrome-test-utils |
| 82 | + # ]; |
| 83 | + |
| 84 | + # testSystemDepends = with nixpkgs; (drv.testSystemDepends or []) ++ lib.optionals (nixpkgs.stdenv.hostPlatform.isLinux) [ |
| 85 | + # nixpkgs_oldChromium.selenium-server-standalone |
| 86 | + # nixpkgs_oldChromium.chromium |
| 87 | + # which |
| 88 | + # ] ++ lib.optionals (!noGcTest) [ |
| 89 | + # nixpkgs.iproute2 |
| 90 | + # ]; |
| 91 | + # } // lib.optionalAttrs (!noGcTest) { |
| 92 | + # # The headless browser run as part of gc tests would hang/crash without this |
| 93 | + # preCheck = '' |
| 94 | + # export FONTCONFIG_PATH=${nixpkgs.fontconfig.out}/etc/fonts |
| 95 | + # '' + (drv.preCheck or ""); |
| 96 | + # }); |
| 97 | + |
| 98 | + reflex-dom = lib.pipe super.reflex-dom [ |
| 99 | + (appendConfigureFlags [reflexOptimizerFlag useTemplateHaskellFlag useWebkit2GtkFlag]) |
| 100 | + (if useWebkit2Gtk then lib.id else addBuildDepends [self.jsaddle-warp]) |
| 101 | + (x: x.override { |
| 102 | + jsaddle-webkit2gtk = if useWebkit2Gtk |
| 103 | + then self.jsaddle-webkit2gtk |
| 104 | + else null; |
| 105 | + }) |
| 106 | + ]; |
| 107 | + |
| 108 | + } |
0 commit comments