Attribute 'ghc882' missing

I’m trying to build disconsis literate xmonad config here:

I get this:

b0ef $ ~/.pkg/disconsis.literate-xmonad-config.git >
make build
bin/build --quiet
error: attribute 'ghc882' missing

       at «string»:1:43:

            1| with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc882 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib''   ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; LANG="en_US.UTF-8";} ""
             |                                           ^
       Did you mean one of ghc884, ghc902 or ghc922?
(use '--show-trace' to show detailed location information)
make: *** [Makefile:5: build] Error 1

I do however find many references on google on this problem, but they all seem to solve it, without really describing how they solve it;)

I also can’t really see that this package references 882 at all;)

1 Like

You need to find an older commit of nixpkgs that still provides ghc882 and pin that.

I did a “quick” bisection for you, and it seems as if 0ed2140a was the last that still had 8.8.2.

I bisected master though. Not sure when it got removed from unstable or within which releases it would still be.

1 Like

I took a quick look at it, and it looks like this is using stack's Nix integration.

The stack.yaml has a resolver of lts-15.3, which is apparently ghc-8.8.2. If you run stack build --verbose, you can see the nix-shell command line it is using. Part of which likely calls with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc882 git gcc gmp]; ..., and therefore tries to use ghc882.

You have three main solutions:

  1. Like @NobbZ says, run stack with a Nixpkgs version that contains ghc-8.8.2, possibly with the flag --nix-path nixpkgs= Or use a related option in stack.yaml.

    An alternative is to use stack-shell.nix file, and pin nixpkgs there.

  2. There’s some stack option that says, “just use whatever GHC you find on the PATH”. You could enable this option, and just pull ghc884 into your environment. A Haskell project that builds with ghc-8.8.2 is likely to also work when building against ghc-8.8.4. Current Nixpkgs will all likely have ghc884.

  3. Update your project to use a later GHC / stackage resolver, which will more likely be in current Nixpkgs.

If this were me, I would go with the --nix-path choice first since it is so easy. If that works, I’ll probably create a stack-shell.nix.

Then when I had time, at some point I’d try to update to a more recent GHC or stackage resolver.