I have a problem with GL on NixOS: the problem seems old, but in 2017 there is still no easy solution!
I am trying to create a Haskell program using the Gloss
library. I installed Gloss
and everything he needs using nix-shell -p mesa
and it seems to be properly built and istalled (using cabal install
). However, if I create a program in the same nix-shell
, it does not work:
$ nix-shell -p mesa_glu [nix-shell:]$ ghc --make -O2 SnakePar.hs Linking SnakePar ... [nix-shell:]$ ./SnakePar SnakePar: user error (unknown GLUT entry glutInit)
While working outside of nix-shell
, the binding step is not performed:
$ ghc --make -O2 SnakePar.hs [1 of 1] Compiling Main ( SnakePar.hs, SnakePar.o ) Linking SnakePar ... /nix/store/<hash>-binutils-2.27/bin/ld: cannot find -lGLU /nix/store/<hash>-binutils-2.27/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status `cc' failed in phase `Linker'. (Exit code: 1)
This happens, although I manually installed the glu
library through nix-env -iA
.
$ nix-env -q cabal-install-1.24.0.0 ghc-8.0.1 glu-9.0.0
I tried using freeglut
or mesa
in the same way, but none of them (or even all together) worked.
What am I missing?
This question matters, but it does not help: nixos + haskell + opengl (prerequisites)
Solution: After switching to the stack, everything works.
source share