Skip to content

Commit af55dd9

Browse files
committed
Workaround to not build cardano-lmdb but still resolve
1 parent 51b46f4 commit af55dd9

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

flake.nix

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@
142142
"https://chap.intersectmbo.org/" = inputs.CHaP;
143143
};
144144
# Also currently needed to make `nix flake lock --update-input CHaP` work.
145+
# Disable --enable-tests in the plan so the solver doesn't
146+
# resolve test-only dependencies of all packages (e.g.
147+
# ouroboros-consensus:lmdb → cardano-lmdb). tests: True in
148+
# cabal.project still enables tests for local packages.
149+
configureArgs = "--disable-tests --disable-benchmarks";
145150
cabalProjectLocal = ''
146151
repository cardano-haskell-packages-local
147152
url: file:${inputs.CHaP}
@@ -153,10 +158,6 @@
153158
# Packages in this repo
154159
p.cardano-api
155160
p.cardano-api-gen
156-
# Work around for issue created by our inability to register sublibs.
157-
# This package may need to be built and we need to make sure its dependencies
158-
# are included in `ghc-pkg list` (in particular `compact`)
159-
p.ouroboros-consensus
160161
];
161162
# tools we want in our shell, from hackage
162163
shell.tools =
@@ -294,6 +295,19 @@
294295
src = nixpkgs.blst.src;
295296
});
296297
};
298+
# Stub pkg-config file so the cabal solver can resolve
299+
# cardano-lmdb (a transitive dependency of ouroboros-consensus
300+
# that nothing in this project actually needs). Without this,
301+
# the solver rejects cardano-lmdb because lmdb is not
302+
# available for wasm. Per-component builds ensure it is never
303+
# actually compiled.
304+
lmdb-pkg-config-stub = wasm-pkgs.writeTextDir "lib/pkgconfig/lmdb.pc" ''
305+
Name: lmdb
306+
Description: Stub for cabal solver — not actually built
307+
Version: 0.9.33
308+
Libs: -llmdb
309+
Cflags:
310+
'';
297311
in
298312
lib.optionalAttrs (system != "x86_64-darwin") {
299313
wasm = wasm-pkgs.mkShell {
@@ -308,6 +322,7 @@
308322
wasm.libsodium
309323
wasm.secp256k1
310324
wasm.blst
325+
lmdb-pkg-config-stub
311326
]
312327
++ lib.optional (system == "x86_64-linux" || system == "aarch64-linux") wasm-pkgs.envoy-bin;
313328
};

0 commit comments

Comments
 (0)