Haskell-language-server support for xmonad

I’m trying to get IDE support for my xmonad.hs using haskell-language-server. Here’s my configuration.nix:

windowManager = {
  xmonad = {
    enable = true;
    enableContribAndExtras = true;
    extraPackages = haskellPackages: [
      haskellPackages.dbus
      haskellPackages.List
      haskellPackages.monad-logger
      haskellPackages.xmonad
    ];
  };
};

The language server plugin on my IDE understandably had problems in recognizing imports: Could not find module ‘XMonad...’.. So I tried to provide it an hie.yaml

cradle:
  bios:
    program: "./hie-bios.sh"
    with-ghc: "/nix/store/waa0dlvlszwbplrz5c7j674ab6v1n5wi-ghc-8.8.4-with-packages/bin/ghc"

Where hie-bios.sh is echo "xmonad" >> $HIE_BIOS_OUTPUT (I don’t understand what this does though). I derived the with-ghc path by looking at GHC command in the xmonad path in the store.

I’m sure there’s a better/simpler way to do this without hardcoding paths like this. Suggestions?

This is the only thing that helped me to get LSP support for xmonad

Only addition is that I used nix-tree util to find exact path to my “ghc-…-with-packages” (the dependency of the xmonad-with-packages package)
and that I had to run “haskell-language-server” manually from the directory that contians “xmonad.hs”

and I think that it will not be hard to generate this file from nix expression, so that hash gets subsctituted on system rebuild.

Tried to find any other resource that would explain how to add LSP for xmonad.
Things that got me close, but not close enough:

I would also gladly accept any help in figuring out a better way