stack build error: attribute ‘ghc822’ missing, at (string):1:53

后端 未结 5 1178
后悔当初
后悔当初 2021-02-14 11:53

I am attempting to build my haskell project on NixOS.

Running $ stack build gives the following error.

$ stack build
error: attribute ‘ghc82         


        
5条回答
  •  生来不讨喜
    2021-02-14 12:12

    You can provide an old GHC version using a shell.nix file place in the root of your project:

    with import (fetchTarball https://github.com/NixOS/nixpkgs/archive/83b35508c6491103cd16a796758e07417a28698b.tar.gz) {};
    let ghc = haskell.compiler.ghc802;
    in haskell.lib.buildStackProject {
        inherit ghc;
        name = "myEnv";
        buildInputs = [ pcre ];
    }
    

    Use a tar url from https://github.com/NixOS/nixpkgs/releases for a version of nixpkgs that contains the GHC version you need.

    Then run nix-shell in the root of the project. This will put you into a shell in which you can perform stack build successfully since it would have access to the correct GHC version.

提交回复
热议问题