Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
I'm trying to run ghcid/ghci in a nix-shell, which always presents the problem of test dependencies being invisible. As a workaround I wanted to try and use a cabal flag that adds those same dependencies to the library. Now the problem is that I have to activate that flag for the ghci session.
My intuition was that I would have to enable the flag on the package I pass to nix-shell as dependency, like so:
packages = p: [(enableCabalFlag p.mainPackage "devdeps")];
hook = "ghcid ...";
but that doesn't have the desired effect.
Anyone have an idea?
I usually do something along the lines of
name = "foo-shell";
paths = with pkgs; [ ghcid haskellPackages.cabal-install (haskellPackages.ghcWithPackages( _: mypackage.buildInputs ++ mypackage.propagatedBuildInputs)];
It's the propagatedBuildInputs which brings the test deps
curious, propagatedBuildInputs doesn't seem to contain the test deps here (I looked at them with builtins.trace). Do you define them something like this?
Yeah, although with cabal, but shouldn't make a difference
hmm I think I have dontCheck somewhere, maybe that thwarts my efforts
Sounds sensible enough
looks like there's some weirdness going on in ghc.shellFor that I'm unable to figure out.
Despite the test deps being present in buildInputs of the package derivation and shellFor forwarding those to mkDerivation, and appending the buildInputs manually passed to shellFor (where I also tried adding hedgehog explicitly), the test dep isn't visible to ghci.
However, replacing shellFor with mkDerivation and using your ghcWithPackages method seems to work just fine, so I guess I'll be using that for now :shrug:
in any case, thanks :100: for your input!