Haskell overrides and dependencies

I’m trying to use haskellPackages.override to bump a version of a broken package (ghcide). Somewhat simplified I’m doing

        haskellPackages = pkgs.haskellPackages.override {
          overrides = self: super: {
            ghcide = (self.callHackageDirect {...} {});
            ...
          };
        };

There are a couple of packages where nixpkgs has too old versions, haskell-lsp-types is one of them. However, when bumping that in a similar way I have to also bump quite a few other packages, and some of them are rather basic and trigger a huge number of packages to be re-compiled. I thought that if I could find a way of appending a version to haskellPackages like this:

        haskellPackages = pkgs.haskellPackages.override {
          overrides = self: super: {
            ghcide = (self.callHackageDirect {...} {});
            haskell-lsp-types_0_19_0_0 = (self.callHackageDirect {...} {});
            ...
          };
        };

However, then I’m bumping into the issue that my ghcide doesn’t depend on haskell-lsp-types_0_19_0_0, but on the original/wrong haskell-lsp-types. How do I fix this most easily?

In this particular instance, you’d need to pass haskell-lsp-types_0_19_0_0 to ghcide:

        haskellPackages = pkgs.haskellPackages.override {
          overrides = self: super: {
            ghcide = self.callHackageDirect {...} {
              haskell-lsp-types = self.haskell-lsp-types_0_19_0_0;
            };
            haskell-lsp-types_0_19_0_0 = (self.callHackageDirect {...} {});
            ...
          };
        };

However, what you probably want is to just use the working ghcide expressions maintained by @domenkozar:

GitHub - hercules-ci/ghcide-nix: Nix installation for ghcide

1 Like

Ah, that’s what the second argument to callHackageDirect is for.

Actually, I was using the expression at hecules-ci/ghcide-nix, but found that I wanted to attempt setting up my own expression for ghcide and other stuff that’s marked broken in nixpkgs.