# Old GHC, Stack, and NixOS

**URL:** <https://discourse.haskell.org/t/old-ghc-stack-and-nixos/2312>\
**Category:** Learn\
**Created:** [April 3, 2021, 11:00pm UTC](https://discourse.haskell.org/t/old-ghc-stack-and-nixos/2312 "2021-04-03T23:00:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![greydot](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/greydot/32/3296_2.png) [@greydot](https://discourse.haskell.org/u/greydot)\
**Post date:** [April 3, 2021, 11:00pm UTC](https://discourse.haskell.org/t/old-ghc-stack-and-nixos/2312/1 "2021-04-03T23:00:48Z")

</div>

Hello,

This is more of a Haskell and Stack question than a Nix question, so I’m gonna post it here instead of NixOS discouse.

Recently, GHC 8.6.5 was dropped from nixpkgs master branch. I added it back via an overlay, but the problem is, stack refuses to use that particular instance of GHC 8.6.5 on NixOS.

Is there a way to force stack to use system ghc on NixOS while still using Nix for other packages?

---

<div class="post-metadata">

**Author:** ![cdepillabout](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/cdepillabout/32/1168_2.png) [@cdepillabout](https://discourse.haskell.org/u/cdepillabout)\
**Post date:** [April 6, 2021, 2:24am UTC](https://discourse.haskell.org/t/old-ghc-stack-and-nixos/2312/2 "2021-04-06T02:24:49Z")

</div>

Could you link to the project you’re trying to get working?

If all you want to do is force stack to use the system ghc, there is a command line flag for that (as well as an option you can throw in stack.yaml):

> **[FAQ - The Haskell Tool Stack](https://docs.haskellstack.org/en/stable/faq/#i-already-have-ghc-installed-can-i-still-use-stack)**

However, it might just be easier for you to write a `stack-shell.nix` file where you can pin the GHC version you require:

> **[Nix integration - The Haskell Tool Stack](https://docs.haskellstack.org/en/stable/nix_integration/#using-a-custom-shellnix-file)**

I have a project where I do something similar to this. It is somewhat complicated, but hopefully it will give you something to poke around with:

> <https://github.com/cdepillabout/termonad/blob/d0f8c9a1dc082aa3c2a56ed668914a2abeea86d3/stack.yaml#L41>

> <https://github.com/cdepillabout/termonad/blob/d0f8c9a1dc082aa3c2a56ed668914a2abeea86d3/.nix-helpers/stack-shell.nix#L16>

---

<div class="post-metadata">

**Author:** ![greydot](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/greydot/32/3296_2.png) [@greydot](https://discourse.haskell.org/u/greydot)\
**Post date:** [April 7, 2021, 6:25pm UTC](https://discourse.haskell.org/t/old-ghc-stack-and-nixos/2312/3 "2021-04-07T18:25:52Z")

</div>

No, unfortunately I can’t link it due to licensing reasons.

But I got this figured out. Turns out, when given `--system-ghc` flag on NixOS, Stack still checks whether the ghc derivation has a predefined hash. What helped is the following combination of flags in my `stack.yaml`.

```haskell
system-ghc: true
install-ghc: false
skip-ghc-check: true

```
