Import and use ghide-nix

Since haskellPackages.ghcide currently is broken I thought I’d try to pull in ghcide-nix. I’m failing miserably though :cry:

I tried modify my shell.nix, just importing and adding it to buildInputs:

with (import <nixpkgs> {});

  ghcide-nix = import (builtins.fetchGit {
    name = "ghcide-nix";
    url =;
    rev = "4f3e98f211f34698805eb7a3c5f7b4361d97f541";
  def = import ./default.nix;
  hl = haskell.lib;

  shell-pkgs = with haskellPackages;

def.pkg.overrideAttrs (attrs: {
  src = null;
  buildInputs = shell-pkgs ++ attrs.buildInputs;
  shellHook = ''
    echo 'Entering ${}'

that fails with with

error: cannot coerce a function to a string, at /nix/store/3abw7pkjmf850s048q45i203vj9z3czd-nixpkgs-20.03pre203317.8bb98968edf/nixpkgs/pkgs/development/haskell-modules/make-package-set.nix:311:9

I clearly don’t understand how the expression in that repo is supposed to be used. Hopefully someone else here can make more sense of it.

I believe you need something like ghcide-nix = import (...) {};, because the default.nix provided by the repo contains a function.

Yes, indeed.

I managed to figure out that it’s a function returning a set

  ghcide-ghc865 = <ghcide for ghc 8.6.5>;
  ghcide-ghc864 = <ghcide for ghc 8.6.4>;
  ghcide-ghc844 = <ghcide for ghc 8.4.4>;
1 Like