@@ -1,6 +1,6 @@
1−{ cabalexpr, pkgs, compiler ? "Ghc", os ? "OSX", arch ? "X86_64" }:
1+{ cabalexpr, pkgs, compiler ? "Ghc", version, os ? "Osx", arch ? "X86_64" }:
2assert (builtins.elem compiler ["Ghc" "Ghcjs" "Nhc" "Yhc" "Hugs" "Hbc" "Helium" "Jhc" "Lhc" "Uhc" "Eta"]);
2assert (builtins.elem compiler ["Ghc" "Ghcjs" "Nhc" "Yhc" "Hugs" "Hbc" "Helium" "Jhc" "Lhc" "Uhc" "Eta"]);
3−assert (builtins.elem os ["Linux" "Windows" "OSX" "FreeBSD" "OpenBSD" "NetBSD" "DragonFly" "Solaris" "AIX" "HPUX" "IRIX" "HaLVM" "Hurd" "IOS" "Android" "Ghcjs"]);
3+assert (builtins.elem os ["Linux" "Windows" "Osx" "FreeBSD" "OpenBSD" "NetBSD" "DragonFly" "Solaris" "AIX" "HPUX" "IRIX" "HaLVM" "Hurd" "IOS" "Android" "Ghcjs"]);
4assert (builtins.elem arch ["I386" "X86_64" "PPC" "PPC64" "Sparc" "Arm" "Aarch64" "Mips" "SH" "IA64" "S390" "Alpha" "Hppa" "Rs6000" "M68k" "Vax" "JavaScript"]);
4assert (builtins.elem arch ["I386" "X86_64" "PPC" "PPC64" "Sparc" "Arm" "Aarch64" "Mips" "SH" "IA64" "S390" "Alpha" "Hppa" "Rs6000" "M68k" "Vax" "JavaScript"]);
@@ -26,7 +26,16 @@ with rec {
26 # pkgconfig name -> nix package
26 # pkgconfig name -> nix package
27 pkgconfPkgs = { libpcre = pkgs.pcre; };
27 pkgconfPkgs = { libpcre = pkgs.pcre; };
29− compiler = cabal.compiler // { "is${compiler}" = true; };
29+ compiler = cabal.compiler // {
30+ "is${compiler}" = true;
32+ eq = v: builtins.compareVersions version v == 0;
33+ lt = v: builtins.compareVersions version v == -1;
34+ gt = v: builtins.compareVersions version v == 1;
35+ le = v: eq v || lt v;
36+ ge = v: eq v || gt v;
30 system = cabal.os // { "is${os}" = true; }
39 system = cabal.os // { "is${os}" = true; }
31 // cabal.arch // { "is${arch}" = true; };
40 // cabal.arch // { "is${arch}" = true; };
@@ -50,10 +59,14 @@ in mkDerivation ({
50} // pkgs.lib.optionalAttrs (builtins.hasAttr pname expr.components) {
59} // pkgs.lib.optionalAttrs (builtins.hasAttr pname expr.components) {
51 libraryHaskellDepends = expr.components.${pname}.depends;
60 libraryHaskellDepends = expr.components.${pname}.depends;
52 libraryPkgconfigDepends = expr.components.${pname}.pkgconfig or [];
61 libraryPkgconfigDepends = expr.components.${pname}.pkgconfig or [];
62+ librarySystemDepends = expr.components.${pname}.libs or [];
63+ libraryToolDepends = expr.components.${pname}.build-tools or [];
53} // pkgs.lib.optionalAttrs (builtins.hasAttr "exes" expr.components) {
64} // pkgs.lib.optionalAttrs (builtins.hasAttr "exes" expr.components) {
54 executableHaskellDepends = collectAttr "depends" expr.components.exes;
65 executableHaskellDepends = collectAttr "depends" expr.components.exes;
55} // pkgs.lib.optionalAttrs (builtins.hasAttr "tests" expr.components) {
66} // pkgs.lib.optionalAttrs (builtins.hasAttr "tests" expr.components) {
56 testHaskellDepends = collectAttr "depends" expr.components.tests;
67 testHaskellDepends = collectAttr "depends" expr.components.tests;
57} // pkgs.lib.optionalAttrs (builtins.hasAttr "benchmarks" expr.components) {
68} // pkgs.lib.optionalAttrs (builtins.hasAttr "benchmarks" expr.components) {
58 benchmarkHaskellDepends = collectAttr "depends" expr.components.benchmarks;
69 benchmarkHaskellDepends = collectAttr "depends" expr.components.benchmarks;
70+} // pkgs.lib.optionalAttrs (builtins.hasAttr "src" expr) {