diff --git a/.gitignore b/.gitignore index fa507cf..237cc52 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ cabal.project.local* dist*/ report.html *.bak +.direnv/ +.envrc diff --git a/default.nix b/default.nix deleted file mode 100644 index 225fc5f..0000000 --- a/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs ? import (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz)) -, haskellCompiler ? "ghc865" -}: - pkgs.haskell-nix.cabalProject { - src = pkgs.haskell-nix.haskellLib.cleanGit { src = pkgs.nix-gitignore.gitignoreSource [] ./.; }; - ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler}; - # pkg-def-extras = [ - # # Additional packages ontop of all those listed in `cabal.project` - # ]; - # modules = [ - # # Specific package overrides would go here for example: - # packages.cbors.package.ghcOptions = "-Werror"; - # packages.cbors.patches = [ ./one.patch ]; - # packages.cbors.flags.optimize-gmp = false; - # # It may be better to set flags in `cabal.project` instead - # # (`plan-to-nix` will include them as defaults). - # ]; - } diff --git a/shell.nix b/shell.nix index 9451c76..a4f6bdd 100644 --- a/shell.nix +++ b/shell.nix @@ -1,125 +1,7 @@ -{ nixpkgs ? import {}, compiler ? "default", doBenchmark ? false }: +{ pkgs ? import {}}: let - - 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, OpenGLRaw, 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 OpenGLRaw 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 {}); - + affection = pkgs.haskellPackages.callCabal2nix "affection" (gitignore ./.) {}; + gitignore = dir: pkgs.nix-gitignore.gitignoreSource [] dir; in - - if pkgs.lib.inNixShell then drv.env else drv + affection.env