# Stack new: error: attribute 'ghc' missing

**URL:** https://discourse.nixos.org/t/stack-new-error-attribute-ghc-missing/23405
**Category:** Help
**Created:** [November 22, 2022, 1:33pm UTC](https://discourse.nixos.org/t/stack-new-error-attribute-ghc-missing/23405 "2022-11-22T13:33:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![thomas-huegel](https://discourse.nixos.org/user_avatar/discourse.nixos.org/thomas-huegel/32/7839_2.png) [@thomas-huegel](https://discourse.nixos.org/u/thomas-huegel)
#### Post date: [November 22, 2022, 1:33pm UTC](https://discourse.nixos.org/t/stack-new-error-attribute-ghc-missing/23405/1 "2022-11-22T13:33:22Z")

</div>

Hi,  
It seems that Stack wants to use a newer version of GHC, a version that is not present in my NixOS packages yet.  
That hinders reproducibility a lot.  
Yesterday it worked, and today it does not work any more.  
On the same machine, without changing its configuration.  
Am I missing anything?  
Thanks for your help!

---

<div class="post-metadata">

### Author: ![sternenseemann](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sternenseemann/32/3809_2.png) [@sternenseemann](https://discourse.nixos.org/u/sternenseemann)
#### Post date: [November 22, 2022, 5:32pm UTC](https://discourse.nixos.org/t/stack-new-error-attribute-ghc-missing/23405/2 "2022-11-22T17:32:22Z")

</div>

Can you figure out which channel it is using / what revision it is at and post the error message below? What stack resolver are you using?

The [stack nix integration](https://docs.haskellstack.org/en/stable/nix_integration/) guesses what the GHC version it wants depending on the used resolver would be called and expects it to be found in `<nixpkgs>`. This goes wrong as we tend to clean up old GHC versions. We have the latest minor versions of the 8.8, 8.10, 9.0, 9.2 and 9.4 series currently.

In many cases the fix is to either:

- Pin the used channel to a specific revision that has the desired GHC via the `nix.path` stack config directive.
- Update the solver to its latest minor version (e.g. LTS-19.13 → LTS 19.33) which will usually have the latest GHC in the series.

---

<div class="post-metadata">

### Author: ![thomas-huegel](https://discourse.nixos.org/user_avatar/discourse.nixos.org/thomas-huegel/32/7839_2.png) [@thomas-huegel](https://discourse.nixos.org/u/thomas-huegel)
#### Post date: [November 25, 2022, 12:52pm UTC](https://discourse.nixos.org/t/stack-new-error-attribute-ghc-missing/23405/3 "2022-11-25T12:52:48Z")

</div>

It complains that `ghc925` is missing.  
I don’t know how to do what you indicate.  
I wonder why as a lambda user I should have anything to do at all.  
Wouldn’t it be better if reproducibility was the default?  
Thank you.

---

<div class="post-metadata">

### Author: ![sternenseemann](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sternenseemann/32/3809_2.png) [@sternenseemann](https://discourse.nixos.org/u/sternenseemann)
#### Post date: [November 26, 2022, 4:43pm UTC](https://discourse.nixos.org/t/stack-new-error-attribute-ghc-missing/23405/4 "2022-11-26T16:43:57Z")

</div>

> [@thomas-huegel](#):
>
> It complains that `ghc925` is missing.

Then you most likely need to update your Nix channels, as GHC 9.5.2 was released relatively recently and [subsequently added to nixpkgs](https://github.com/NixOS/nixpkgs/pull/199424).

> [@thomas-huegel](#):
>
> I don’t know how to do what you indicate.

The stack documentation I linked describes [how to set a specific `NIX_PATH`](https://docs.haskellstack.org/en/stable/nix_integration/#nix-package-sources) just for the specific stack project, which allows you to pin a certain nixpkgs revision. Switching the [resolver](https://docs.haskellstack.org/en/stable/custom_snapshot/) is as easy as changing a configuration value in `stack.yaml`.

Note that the latter doesn’t really apply to you, as you are using an apparently up to date resolver. People usually run into the opposite case that a GHC they need has been dropped from nixpkgs since it is quite outdated already.

> [@thomas-huegel](#):
>
> I wonder why as a lambda user I should have anything to do at all.  
> Wouldn’t it be better if reproducibility was the default?

Depends on what you mean by reproducibility – it is not magic after all.

The stack Nix integration (which we did not even write) can not feasably ensure that you have the package definitions available for any given GHC version. And we can’t package GHC 9.2.5 before it is released, so an outdated channel of course doesn’t include this version of the compiler.
