cleverca22
10/6/2019 - 8:30 PM

Glut.hs

import System.Exit (exitWith, ExitCode(ExitSuccess))
import Graphics.UI.GLUT

main = do
   (progName, _args) <- getArgsAndInitialize
   initialDisplayMode $= [ SingleBuffered, RGBMode ]
   initialWindowSize $= Size 500 500
   _ <- createWindow progName
   exitWith ExitSuccess
with import <nixpkgs> {};

lib.fix (self: {
  ghc = haskellPackages.ghcWithPackages (ps: with ps; [ GLUT ]);
  thing = runCommandCC "thing" { buildInputs = [ self.ghc ]; } ''
    mkdir -pv $out/bin/
    ghc ${./Glut.hs} -o $out/bin/thing
  '';
})