0

As recommended by Haskell/Nix expert lan Burzynski, I'm trying to use Nix install the correct GHC version for Plutus as follows:

nix shell nixpkgs#haskell.compiler.ghc8107BinaryMinimal nixpkgs#cabal-install

However I get the following

error: flake 'flake:nixpkgs' does not provide attribute 
packages.x86_64-linux.haskell.compiler.ghc8107BinaryMinimal', 
'legacyPackages.x86_64-linux.haskell.compiler.ghc8107BinaryMinimal' or 
'haskell.compiler.ghc8107BinaryMinimal'

Can anyone help?

1 Answer 1

0

Installing the compiler using nix-shell -p haskell.compiler.ghc8107BinaryMinimal seems to work. Can't explain why though. I guess it is related to where nix looks for the package.

4
  • Thanks for the response! But I thought that commands that contain "-" like nix-shell were deprecated. Is it possible to use "nix-shell" to install ghc and then use "nix shell" thereafter for Plutus development?
    – Eric
    Nov 17, 2023 at 11:59
  • You are correct. So I think I know what is causing this. The package haskell.compiler.ghc8107BinaryMinimal is only available in the 23.05 channel and not in the unstable channel. You might have configured your nix to use the nixpkgs-unstable as the default channel, which errors because it is not there. Forcing nix to use the 23.05 channel like so nix shell github:NixOS/nixpkgs/nixos-23.05#haskell.compiler.ghc8107BinaryMinimal will proceed to install the package in your shell. I think nix-shell uses the 23.05 channel by default, which is why that command worked. Nov 17, 2023 at 12:48
  • Thanks for the tip! I don't get the error message anymore, but after downloading, the process just exits without taking me into the nix shell.
    – Eric
    Nov 20, 2023 at 14:20
  • Yeah, in fact that is the expected behavior and you are placed in a nix shell, but with the exception that you keep your existing shell environment with the addition that the downloaded package has been made available to your shell. Running ghc --version should succeed using the correct version. You can exit out of that nix shell by sending the EOF character using ctrl+d. Nov 21, 2023 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.