I have read [NixOS, Haskell, opengl : problems with building and running openGL programs](https://stackoverflow.com/questions/41527061/nixos-haskell-opengl-problems-with-building-and-running-opengl-programs) and all the other corresponding issues, but I can't get a simple Haskell gloss project (that used to work a few months ago) to work.

Using a github project
----------------------

Try the following:

```
$ git clone https://www.github.com/turion/rhine
$ cd rhine/
$ cd rhine-gloss/
$ stack build
$ stack exec rhine-gloss-gears 
freeglut (rhine-gloss-gears):  ERROR:  Internal error <FBConfig with necessary capabilities not found> in function fgOpenWindow

```

This project uses the stack nix integration as explained in [this answer](https://stackoverflow.com/a/41588628/562583), but since `mesa` has been renamed recently, the relevant part in `stack.yaml` is now:

```
nix:
  enable: true
  packages: [libGL libGLU freeglut]

```

From scratch
------------

Make sure you have cabal, stack and nix installed. Then follow these commands:

```
$ mkdir tempgloss
$ cd tempgloss

```

Create two files with these contents:

```
$ cat Main.hs 
import Graphics.Gloss
main = display (InWindow "Nice Window" (200, 200) (10, 10)) white (Circle 80)

$ cat stack.yaml 
resolver: lts-12.10
nix:
  enable: true
  packages: [libGL libGLU freeglut]

```

Now execute:

```
$ cabal init --is-executable -n --main-is=Main.hs -d gloss -d base -l MIT
[...]
$ stack build
[...]
$ stack exec tempgloss 

```

What's wrong here?