Skip to content

Commit 6e10ac7

Browse files
authored
Add a multi-repl-enabled cabal to shell (#242)
This adds a multi-repl-enabled (see haskell/cabal#8726) cabal (using a recent commit from `master`) to the shell. When using GHC >=9.4, one can then run e.g. ```console cabal-multi-repl repl ouroboros-consensus ouroboros-consensus-diffusion ``` to get a REPL with all components in `ouroboros-consensus` and `ouroboros-consensus-diffusion` 🎉 `ghcid` also works, e.g. ```console ghcid -c 'cabal-multi-repl repl ...' ``` Beware that this feature is still somewhat experimental, e.g. `cabal-multi-repl repl ouroboros-consensus-cardano` (or also `-protocol`) are stalling for me, and selecting individual components involving sublibraries fails with this message: ```console $ cabal-multi-repl repl ouroboros-consensus:consensus-testlib ouroboros-consensus:consensus-test Error: Dependency on unbuildable library 'consensus-testlib' from ouroboros-consensus ``` Still, this might already be useful, and should not have any risks/maintenance burden.
2 parents 4a834d2 + cf13c87 commit 6e10ac7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

nix/shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ in
66
hsPkgs.shellFor {
77
nativeBuildInputs = [
88
pkgs.cabal
9+
pkgs.cabal-multi-repl
910
pkgs.fd
1011
pkgs.nixpkgs-fmt
1112
pkgs.stylish-haskell

nix/tools.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@ in
1313

1414
cabal = tool "cabal" "latest" { };
1515

16+
cabal-multi-repl = (final.haskell-nix.cabalProject {
17+
# cabal master commit containing https://github.com/haskell/cabal/pull/8726
18+
src = final.fetchFromGitHub {
19+
owner = "haskell";
20+
repo = "cabal";
21+
rev = "249374d16b328736a01a4c7e84fa42fbad7422e7";
22+
hash = "sha256-KQm3NwQAvsii+6o7MRRL4emCEBUT77foywTBHfq1pxg=";
23+
};
24+
index-state = tool-index-state;
25+
inherit (final.hsPkgs.args) compiler-nix-name;
26+
cabalProject = ''
27+
packages: Cabal-syntax Cabal cabal-install-solver cabal-install
28+
'';
29+
configureArgs = "--disable-benchmarks --disable-tests";
30+
modules = [{
31+
packages.cabal-install.components.exes.cabal.postInstall = ''
32+
mv $out/bin/cabal $out/bin/cabal-multi-repl
33+
wrapProgram $out/bin/cabal-multi-repl --add-flags --enable-multi-repl
34+
'';
35+
}];
36+
}).cabal-install.components.exes.cabal;
37+
1638
stylish-haskell = tool "stylish-haskell" "0.14.4.0" { };
1739

1840
cabal-fmt = tool "cabal-fmt" "0.1.6" { };

0 commit comments

Comments
 (0)