Haskell-language-server packages messes with hlint provided in dev shell

When I provide the hlint package together with haskell-language-server I get this issue where the shell environment provides two versions of hlint

$ which -a hlint

However this issue only occurs when providing HLS and hlint together. If I remove haskell-language-server I get

$ which -a hlint

which is what I expected. So it seems like HLS is providing its own hlint somehow? How can I prevent HLS from providing hlint?

Flake to reproduce issue:

  description = "HLS bug example";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    haskell-nix = {
      inputs.flake-utils.follows = "flake-utils";
      url =

    flake-utils = {
      url = "github:numtide/flake-utils";
      inputs.nixpkgs.follows = "nixpkgs";

  outputs = { self, nixpkgs, flake-utils, haskell-nix }:
    flake-utils.lib.eachSystem (with flake-utils.lib.system; [ x86_64-linux x86_64-darwin aarch64-darwin ]) (system:
      let ghc-version = "ghc8107";
          pkgs = nixpkgs.legacyPackages.${system};
          hpkgs = pkgs.haskell.packages.${ghc-version};
          haskellNix = haskell-nix.legacyPackages.${system};
      in {
        devShell = hpkgs.shellFor {
          packages = p : [];
          nativeBuildInputs = with hpkgs; [
            ((haskellNix.haskell-nix.hackage-package {
              name = "hlint";
              version = "3.4";
              compiler-nix-name = ghc-version;
              index-state = "2022-05-05T00:00:00Z";

You are trying to mix and match two completely separate infrastructures that are neither meant to work nor tested together. You’ll have to investigate if it is possible to work around this issue yourself.

I’d recommend to either try getting HLS from haskell.nix as well or to switch to the nixpkgs Haskell infrastructure altogether — it also provides hlint after all.

1 Like

I think hlint is embedded into hls as a plugin so you can disable it.

The reason I’m using haskell.nix to provide hlint here is that haskell.packages.ghc8107.hlint_3_4 is broken and I don’t know how to fix it (I attempted haskell.lib.addExtraLibraries to no avail). Moreover it doesn’t seem to matter where I provide the hlint from. If I provide an hlint package from nixpkgs that is a different version from the one provided by HLS I get the same issue with two symlinked versions of hlint.

I guess we would need to ask @maralorn, but I suspect this could be a necessary problem in the sense that 8.10.7 HLS can’t be built with hlint 3.4.

Additional context:


This is due to propagation and there is not much we can do about it. Seems like the issue is that HLS is also a library so haskellPackages.haskell-language-server needs to propagate its (library) deps.