diff --git a/shell.nix b/shell.nix index 4d9f121..6d4b133 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,125 @@ +{ nixpkgs ? import {}, compiler ? "default", doBenchmark ? false }: + let - hsPkgs = import ./default.nix {}; + + inherit (nixpkgs) pkgs; + + nanovg = with haskellPackages; callPackage ( + { mkDerivation, base, bytestring, c2hs, containers, glew + , hspec, inline-c, libGL, libGLU, QuickCheck, stdenv, text, vector + }: + mkDerivation { + pname = "nanovg"; + version = "0.6.0.0"; + sha256 = "e35a2772f2a2e71916013cab70eeb8eedd6f66b5490ddf7ce237c8c76895d496"; + revision = "1"; + editedCabalFile = "1lhfsq50r9bdby7mfscw8ih3wsz2m19lr2a2z9b6diaf5kz76vij"; + isLibrary = true; + isExecutable = true; + doCheck = false; + libraryHaskellDepends = [ base bytestring containers text vector ]; + librarySystemDepends = [ glew libGL libGLU ]; + libraryPkgconfigDepends = [ glew ]; + libraryToolDepends = [ c2hs ]; + testHaskellDepends = [ base containers hspec inline-c QuickCheck ]; + homepage = "https://github.com/cocreature/nanovg-hs"; + description = "Haskell bindings for nanovg"; + license = stdenv.lib.licenses.isc; + }) {}; + + glib = with haskellPackages; callPackage( + { mkDerivation, base, bytestring, Cabal, containers, glib + , stdenv, text, utf8-string, gtk2hs-buildtools + }: + mkDerivation { + pname = "glib"; + version = "0.13.8.0"; + sha256 = "9cce6fb44e3c30de2bd330a6902955e3a5fce7b6e9ce41a4afb70e3a7d6e61a2"; + setupHaskellDepends = [ base Cabal gtk2hs-buildtools ]; + libraryHaskellDepends = [ + base bytestring containers text utf8-string + ]; + libraryPkgconfigDepends = [ pkgs.glib ]; + homepage = "http://projects.haskell.org/gtk2hs/"; + description = "Binding to the GLIB library for Gtk2Hs"; + license = stdenv.lib.licenses.lgpl21; + }) {}; + + #gtk2hs-buildtools = with haskellPackages; callPackage( + # { mkDerivation, alex, array, base, Cabal, containers, directory + # , filepath, happy, hashtables, pretty, process, random, stdenv + # }: + # mkDerivation { + # pname = "gtk2hs-buildtools"; + # version = "0.13.4.0"; + # src = ../gtk2hs/tools; + # isLibrary = true; + # isExecutable = true; + # enableSeparateDataOutput = true; + # libraryHaskellDepends = [ + # array base Cabal containers directory filepath hashtables pretty + # process random + # ]; + # libraryToolDepends = [ alex happy ]; + # executableHaskellDepends = [ base ]; + # homepage = "http://projects.haskell.org/gtk2hs/"; + # description = "Tools to build the Gtk2Hs suite of User Interface libraries"; + # license = stdenv.lib.licenses.gpl2; + # }) {}; + + sdl2 = with haskellPackages; callPackage( + { mkDerivation, base, bytestring, deepseq, exceptions, linear, SDL2 + , StateVar, stdenv, text, transformers, vector, weigh + }: + mkDerivation { + pname = "sdl2"; + version = "2.5.1.0"; + sha256 = "fc1d3d4276b2c4f835a5311075abb240385aae7edad8760f6bda55ed8271ed20"; + isLibrary = true; + isExecutable = true; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + base bytestring exceptions linear StateVar text transformers vector + ]; + librarySystemDepends = [ SDL2 ]; + libraryPkgconfigDepends = [ SDL2 ]; + testHaskellDepends = [ base deepseq linear vector weigh ]; + description = "Both high- and low-level bindings to the SDL library (version 2.0.6+)."; + license = stdenv.lib.licenses.bsd3; + doCheck = false; + }) {}; + + f = { mkDerivation, base, bytestring, clock, containers, deepseq + , linear, matrix, monad-loops, monad-parallel, mtl + , OpenGL, random, stdenv, stm, text, uuid, vector + }: + mkDerivation { + pname = "affection"; + version = "0.0.0.9"; + src = ./.; + configureFlags = [ "-fexamples" ]; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + base bytestring clock containers glib linear monad-loops + monad-parallel mtl OpenGL sdl2 stm text uuid vector + ]; + executableHaskellDepends = [ + base containers deepseq linear matrix nanovg OpenGL random sdl2 stm + ]; + homepage = "https://github.com/nek0/affection#readme"; + description = "A simple Game Engine using SDL"; + license = stdenv.lib.licenses.lgpl3; + }; + + haskellPackages = if compiler == "default" + then pkgs.haskellPackages + else pkgs.haskell.packages.${compiler}; + + variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; + + drv = variant (haskellPackages.callPackage f {}); + in - hsPkgs.affection.components.all + + if pkgs.lib.inNixShell then drv.env else drv