|
2 | 2 | # Builds Haskell packages with Haskell.nix |
3 | 3 | ############################################################################ |
4 | 4 | { haskell-nix |
5 | | -, # Version info (git revision) |
6 | | - gitrev |
7 | | -, inputMap |
| 5 | +, incl |
8 | 6 | }: |
9 | 7 | let |
10 | 8 |
|
|
18 | 16 | , buildProject |
19 | 17 | , ... |
20 | 18 | }: { |
21 | | - inherit inputMap; |
22 | 19 | name = "cardano-node"; |
23 | | - # We clean-up src to avoid rebuild for unrelated changes for tests that use $CARDANO_NODE_SRC: |
24 | | - src = |
25 | | - let |
26 | | - src = haskellLib.cleanSourceWith { |
27 | | - src = ../.; |
28 | | - name = "cardano-node-src"; |
29 | | - filter = path: type: |
30 | | - let |
31 | | - relPath = lib.removePrefix "${src.origSrcSubDir}/" path; |
32 | | - in |
33 | | - # excludes top-level directories not part of cabal project (or used by tests): |
34 | | - (type != "directory" |
35 | | - || (builtins.match ".*/.*" relPath != null) |
36 | | - || (!(lib.elem relPath [ |
37 | | - "nix" |
38 | | - "doc" |
39 | | - "ci" |
40 | | - ]) |
41 | | - && !(lib.hasPrefix "." relPath))) |
42 | | - # exclude ".gitignore" files |
43 | | - && !(lib.hasSuffix ".gitignore" relPath) |
44 | | - # only keep cabal.project from files at root: |
45 | | - && (type == "directory" || builtins.match ".*/.*" relPath != null || (relPath == "cabal.project")); |
46 | | - }; |
47 | | - in |
48 | | - src; |
| 20 | + src = ../.; |
49 | 21 | compiler-nix-name = "ghc8107"; |
50 | 22 | cabalProjectLocal = '' |
51 | 23 | allow-newer: terminfo:base |
|
122 | 94 | }) |
123 | 95 | projectPackagesExes; |
124 | 96 | }) |
125 | | - ({ pkgs, config, ... }: { |
126 | | - # Packages we wish to ignore version bounds of. |
127 | | - # This is similar to jailbreakCabal, however it |
128 | | - # does not require any messing with cabal files. |
129 | | - packages.katip.doExactConfig = true; |
130 | | - # split data output for ekg to reduce closure size |
131 | | - packages.ekg.components.library.enableSeparateDataOutput = true; |
132 | | - # cardano-cli-test depends on cardano-cli |
133 | | - # TODO: do not depend on the whole `src` just to access a few files. |
134 | | - packages.cardano-cli.preCheck = " |
135 | | - export CARDANO_CLI=${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable} |
136 | | - export CARDANO_NODE_SRC=${src} |
137 | | - "; |
138 | | - packages.cardano-node-chairman.components.tests.chairman-tests.build-tools = |
139 | | - lib.mkForce [ |
140 | | - pkgs.lsof |
141 | | - config.hsPkgs.cardano-node.components.exes.cardano-node |
142 | | - config.hsPkgs.cardano-cli.components.exes.cardano-cli |
143 | | - config.hsPkgs.cardano-node-chairman.components.exes.cardano-node-chairman |
144 | | - ]; |
145 | | - # cardano-node-chairman depends on cardano-node and cardano-cli |
146 | | - # TODO: do not depend on the whole `src` just to access a few files. |
147 | | - packages.cardano-node-chairman.preCheck = " |
148 | | - export CARDANO_CLI=${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable} |
149 | | - export CARDANO_NODE=${config.hsPkgs.cardano-node.components.exes.cardano-node}/bin/cardano-node${pkgs.stdenv.hostPlatform.extensions.executable} |
150 | | - export CARDANO_NODE_CHAIRMAN=${config.hsPkgs.cardano-node-chairman.components.exes.cardano-node-chairman}/bin/cardano-node-chairman${pkgs.stdenv.hostPlatform.extensions.executable} |
151 | | - export CARDANO_NODE_SRC=${src} |
152 | | - "; |
153 | | - # cardano-testnet needs access to the git repository source |
154 | | - # TODO: do not depend on the whole `src` just to access a few files. |
155 | | - packages.cardano-testnet.preCheck = " |
156 | | - export CARDANO_CLI=${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable} |
157 | | - export CARDANO_NODE=${config.hsPkgs.cardano-node.components.exes.cardano-node}/bin/cardano-node${pkgs.stdenv.hostPlatform.extensions.executable} |
158 | | - export CARDANO_SUBMIT_API=${config.hsPkgs.cardano-submit-api.components.exes.cardano-submit-api}/bin/cardano-submit-api${pkgs.stdenv.hostPlatform.extensions.executable} |
159 | | - ${lib.optionalString (!pkgs.stdenv.hostPlatform.isWindows) '' |
160 | | - ''} |
161 | | - export CARDANO_NODE_SRC=${src} |
162 | | - "; |
163 | | - }) |
| 97 | + ({ pkgs, config, ... }: |
| 98 | + let |
| 99 | + exportCliPath = "export CARDANO_CLI=${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable}"; |
| 100 | + exportNodePath = "export CARDANO_NODE=${config.hsPkgs.cardano-node.components.exes.cardano-node}/bin/cardano-node${pkgs.stdenv.hostPlatform.extensions.executable}"; |
| 101 | + mainnetConfigFiles = [ |
| 102 | + "configuration/cardano/mainnet-config.yaml" |
| 103 | + "configuration/cardano/mainnet-config.json" |
| 104 | + "configuration/cardano/mainnet-byron-genesis.json" |
| 105 | + "configuration/cardano/mainnet-shelley-genesis.json" |
| 106 | + "configuration/cardano/mainnet-alonzo-genesis.json" |
| 107 | + ]; |
| 108 | + in |
| 109 | + { |
| 110 | + # Packages we wish to ignore version bounds of. |
| 111 | + # This is similar to jailbreakCabal, however it |
| 112 | + # does not require any messing with cabal files. |
| 113 | + packages.katip.doExactConfig = true; |
| 114 | + # split data output for ekg to reduce closure size |
| 115 | + packages.ekg.components.library.enableSeparateDataOutput = true; |
| 116 | + # cardano-cli tests depend on cardano-cli and some config files: |
| 117 | + packages.cardano-cli.components.tests.cardano-cli-golden.preCheck = |
| 118 | + let |
| 119 | + # This define files included in the directory that will be passed to `H.getProjectBase` for this test: |
| 120 | + filteredProjectBase = incl ../. [ |
| 121 | + "scripts/plutus/scripts/v1/custom-guess-42-datum-42.plutus" |
| 122 | + ]; |
| 123 | + in |
| 124 | + '' |
| 125 | + ${exportCliPath} |
| 126 | + export CARDANO_NODE_SRC=${filteredProjectBase} |
| 127 | + ''; |
| 128 | + packages.cardano-cli.components.tests.cardano-cli-test.preCheck = |
| 129 | + let |
| 130 | + # This define files included in the directory that will be passed to `H.getProjectBase` for this test: |
| 131 | + filteredProjectBase = incl ../. mainnetConfigFiles; |
| 132 | + in |
| 133 | + '' |
| 134 | + ${exportCliPath} |
| 135 | + export CARDANO_NODE_SRC=${filteredProjectBase} |
| 136 | + ''; |
| 137 | + packages.cardano-node-chairman.components.tests.chairman-tests.build-tools = |
| 138 | + lib.mkForce [ |
| 139 | + pkgs.lsof |
| 140 | + config.hsPkgs.cardano-node.components.exes.cardano-node |
| 141 | + config.hsPkgs.cardano-cli.components.exes.cardano-cli |
| 142 | + config.hsPkgs.cardano-node-chairman.components.exes.cardano-node-chairman |
| 143 | + ]; |
| 144 | + # cardano-node-chairman depends on cardano-node and cardano-cli, and some config files |
| 145 | + packages.cardano-node-chairman.preCheck = |
| 146 | + let |
| 147 | + # This define files included in the directory that will be passed to `H.getProjectBase` for this test: |
| 148 | + filteredProjectBase = incl ../. [ |
| 149 | + "configuration/chairman" |
| 150 | + "configuration/defaults/byron-mainnet" |
| 151 | + "cardano-cli/test/data/golden/alonzo/genesis.alonzo.spec.json" |
| 152 | + "scripts/protocol-params.json" |
| 153 | + ]; |
| 154 | + in |
| 155 | + '' |
| 156 | + ${exportCliPath} |
| 157 | + ${exportNodePath} |
| 158 | + export CARDANO_NODE_CHAIRMAN=${config.hsPkgs.cardano-node-chairman.components.exes.cardano-node-chairman}/bin/cardano-node-chairman${pkgs.stdenv.hostPlatform.extensions.executable} |
| 159 | + export CARDANO_NODE_SRC=${filteredProjectBase} |
| 160 | + ''; |
| 161 | + # cardano-testnet depends on cardano-node, cardano-cli, cardano-submit-api and some config files |
| 162 | + packages.cardano-testnet.preCheck = |
| 163 | + let |
| 164 | + # This define files included in the directory that will be passed to `H.getProjectBase` for this test: |
| 165 | + filteredProjectBase = incl ../. (mainnetConfigFiles ++ [ |
| 166 | + "configuration/cardano/mainnet-topology.json" |
| 167 | + "configuration/defaults/byron-mainnet" |
| 168 | + "cardano-cli/test/data/golden/alonzo/genesis.alonzo.spec.json" |
| 169 | + "scripts/babbage/alonzo-babbage-test-genesis.json" |
| 170 | + ]); |
| 171 | + in |
| 172 | + '' |
| 173 | + ${exportCliPath} |
| 174 | + ${exportNodePath} |
| 175 | + export CARDANO_SUBMIT_API=${config.hsPkgs.cardano-submit-api.components.exes.cardano-submit-api}/bin/cardano-submit-api${pkgs.stdenv.hostPlatform.extensions.executable} |
| 176 | + export CARDANO_NODE_SRC=${filteredProjectBase} |
| 177 | + ''; |
| 178 | + }) |
164 | 179 | ({ pkgs, ... }: lib.mkIf (!pkgs.stdenv.hostPlatform.isDarwin) { |
165 | 180 | # Needed for profiled builds to fix an issue loading recursion-schemes part of makeBaseFunctor |
166 | 181 | # that is missing from the `_p` output. See https://gitlab.haskell.org/ghc/ghc/-/issues/18320 |
|
206 | 221 | }); |
207 | 222 | in project.appendOverlays (with haskellLib.projectOverlays; [ |
208 | 223 | projectComponents |
209 | | - (final: prev: let inherit (final.pkgs) lib; in { |
| 224 | + (final: prev: |
| 225 | + let inherit (final.pkgs) lib gitrev; in { |
210 | 226 | profiled = final.appendModule { |
211 | 227 | modules = [{ |
212 | 228 | enableLibraryProfiling = true; |
|
0 commit comments