|
6 | 6 | url = "github:tek/ghc-debug/59198910da4573612bf5c6f9969c64fa620db396"; |
7 | 7 | flake = false; |
8 | 8 | }; |
| 9 | + inputs.fenix = { |
| 10 | + url = "github:nix-community/fenix/9d17341a4f227fe15a0bca44655736b3808e6a03"; |
| 11 | + inputs.nixpkgs.follows = "hix/nixpkgs"; |
| 12 | + }; |
9 | 13 |
|
10 | | - outputs = {hix, ghc-debug, ...}: let |
| 14 | + outputs = {hix, ghc-debug, fenix, ...}: let |
11 | 15 |
|
12 | 16 | testEnv = config: { |
13 | 17 | ghc_dir = "${config.toolchain.vanilla.ghc}"; |
|
38 | 42 | ghc-worker = notest; |
39 | 43 | }; |
40 | 44 |
|
41 | | - in hix ({config, build, lib, ...}: { |
| 45 | + in hix ({config, build, lib, util, ...}: let |
| 46 | + |
| 47 | + buckTest = dir: { |
| 48 | + expose = true; |
| 49 | + env = "buck"; |
| 50 | + command = "${import ./ops/buck-test/${dir} { inherit util; }}"; |
| 51 | + }; |
| 52 | + |
| 53 | + in { |
42 | 54 |
|
43 | 55 | compiler = "ghc910"; |
44 | 56 | ghcVersions = []; |
|
64 | 76 | source.build.flavour = "release+split_sections+ipe"; |
65 | 77 | }; |
66 | 78 |
|
| 79 | + mwb-hybrid.source.build = { |
| 80 | + version = "9.10.1"; |
| 81 | + url = "https://gitlab.haskell.org/ghc/ghc"; |
| 82 | + rev = "f9587b0fcc14565953326d0032a3e92a871d0468"; |
| 83 | + hash = "sha256-eSFKCb2jgcxdNuy1NaLgkmjkZrr1FD09RbNm+c8FUW4="; |
| 84 | + flavour = "release+split_sections+ipe"; |
| 85 | + }; |
| 86 | + |
67 | 87 | }; |
68 | 88 |
|
69 | 89 | envs.dev = args: { |
|
100 | 120 | ]; |
101 | 121 | }; |
102 | 122 |
|
| 123 | + envs.hybrid = args: { |
| 124 | + expose.scoped = true; |
| 125 | + env = testEnv args.config; |
| 126 | + package-set.compiler = "mwb-hybrid"; |
| 127 | + overrides = [ |
| 128 | + sharedExeOverrides |
| 129 | + ipeOverrides |
| 130 | + (envOverrides args.config) |
| 131 | + buckBinOverrides |
| 132 | + ]; |
| 133 | + }; |
| 134 | + |
103 | 135 | envs.profiled = args: { |
104 | 136 | env = testEnv args.config; |
105 | 137 | overrides = [ |
|
109 | 141 | package-set.compiler = "mwb-ipe"; |
110 | 142 | }; |
111 | 143 |
|
| 144 | + # ------------------------------------------------------------------------------------------------------------------ |
| 145 | + # Buck |
| 146 | + |
| 147 | + # The environment for the CLI tool `buck`, using the Buck overlay extracted from MWB. |
| 148 | + # `fenix` is a dep of Buck. |
| 149 | + # Exposes a devShell named `buck` that should be used to gain access to the CLI tool. |
| 150 | + envs.buck = { |
| 151 | + expose.shell = true; |
| 152 | + packages = []; |
| 153 | + buildInputs = pkgs: [pkgs.buck2-source]; |
| 154 | + |
| 155 | + package-set.compiler.nixpkgs.overlays = [ |
| 156 | + fenix.overlays.default |
| 157 | + (import ./ops/buck/overlay.nix) |
| 158 | + ]; |
| 159 | + }; |
| 160 | + |
| 161 | + # The environment for our Buck nixpkgs integration, from which GHC and the package set are taken when exposing them |
| 162 | + # in `outputs.packages` below. |
| 163 | + # Uses our custom GHC build and injects a hook into all Haskell derivations that creates `package.cache` in the |
| 164 | + # store dir, which is needed because Buck supplies individual package DBs to GHC. |
| 165 | + envs.buck-build = {config, ...}: { |
| 166 | + packages = []; |
| 167 | + package-set.compiler = "mwb-ipe"; |
| 168 | + env = testEnv config; |
| 169 | + |
| 170 | + overrides = api@{override, ...}: let |
| 171 | + testDeps = import ./ops/test-deps.nix { inherit util; }; |
| 172 | + in testDeps.overrides api // { |
| 173 | + __all = override (drv: { |
| 174 | + postInstall = (drv.postInstall or "") + '' |
| 175 | + ghc-pkg recache --package-db $packageConfDir |
| 176 | + ''; |
| 177 | + }); |
| 178 | + }; |
| 179 | + }; |
| 180 | + |
| 181 | + # The interface that Buck expects when loading Nix packages in `toolchains/BUCK` using those `nix.rules.flake` |
| 182 | + # rules. |
| 183 | + # Exposes the toolchain Haskell packages listed in `./ops/ghc-toolchain-libraries.nix` in the attribute |
| 184 | + # `haskellPackages.libs` as well as Python and the GHC compiler derivation. |
| 185 | + outputs.packages = |
| 186 | + import ./ops/buck/packages.nix { inherit config lib; }; |
| 187 | + |
| 188 | + # ------------------------------------------------------------------------------------------------------------------ |
| 189 | + |
112 | 190 | envs.hls-db = {}; |
113 | 191 |
|
114 | 192 | commands.hls.env = "hls-db"; |
115 | 193 |
|
116 | 194 | output.extraPackages = ["ghc-debug-brick" "eventlog2html" "hp2pretty" "ghc-events"]; |
117 | 195 |
|
| 196 | + commands.comparison-1 = buckTest "comparison1"; |
| 197 | + commands.comparison-2 = buckTest "comparison2"; |
| 198 | + commands.three-layers = buckTest "three-layers"; |
| 199 | + commands.hybrid = buckTest "hybrid"; |
| 200 | + |
118 | 201 | packages = { |
119 | 202 |
|
120 | 203 | ghc-worker = { |
|
170 | 253 | source-dirs = "test"; |
171 | 254 | dependOnLibrary = false; |
172 | 255 | }; |
| 256 | + |
| 257 | + executables.batch-worker = {}; |
| 258 | + |
| 259 | + executables.ghc-bin = { |
| 260 | + dependencies = [ |
| 261 | + "containers" |
| 262 | + "filepath" |
| 263 | + "ghc" |
| 264 | + "ghc-boot" |
| 265 | + "transformers" |
| 266 | + ]; |
| 267 | + dependOnLibrary = false; |
| 268 | + }; |
| 269 | + |
173 | 270 | }; |
174 | 271 |
|
175 | 272 | debug = { |
|
349 | 446 | }; |
350 | 447 |
|
351 | 448 | }); |
| 449 | + |
352 | 450 | } |
0 commit comments