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

CC BY-SA 4.0
2023-11-17T11:59:03.430Z
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
CC BY-SA 4.0
2023-11-17T12:48:39.700Z
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.
Clemens Horn
CC BY-SA 4.0
2023-11-20T14:20:07.757Z
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
CC BY-SA 4.0
2023-11-21T17:04:08.907Z
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`.
Clemens Horn
CC BY-SA 4.0
2023-11-17T09:52:26.927Z
2023-11-17T09:52:26.927Z
Clemens Horn
<p>As recommended by <a href="https://www.youtube.com/watch?v=AgkAwiyxSxA" rel="nofollow noreferrer">Haskell/Nix expert lan Burzynski</a>, I'm trying to use Nix install the correct GHC version for Plutus as follows:</p>
<pre><code>nix shell nixpkgs#haskell.compiler.ghc8107BinaryMinimal nixpkgs#cabal-install
</code></pre>
<p>However I get the following</p>
<pre><code>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'

</code></pre>
<p>Can anyone help?</p>

<plutus><nix><ghc>
Nix error trying to install correct GHC version for Plutus
# Nix error trying to install correct GHC version for Plutus

(Asked by: username_0 on 2023-11-14)

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?

**Tags:** plutus, nix, ghc

---

## 1 answers

### Answer by username_1 on 2023-11-17. Score: 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.

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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.  
> **username_0**: 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.  
> **username_1**: 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`.  

---

