on e94de40 help sign in
haskell.nix/modules/cabal.nix
35 lines 1.1 kB history raw
1{ lib, config, pkgs, ... }:
3let
4 # it also crucially depends on system, and compiler, both of which need to be resolved to the
5 # current system being targeted.
6 hostMap = import ../lib/host-map.nix pkgs.stdenv;
7 cabal = import ../lib/cabal-os-arch-comp.nix;
9 compiler = cabal.compiler // {
10 isGhc = true;
11 # this is partially a hack to support `impl(ghcjs)`.
12 # We set GHC == true _and_ GHCJS == true.
13 isGhcjs = hostMap.os == "Ghcjs";
14 # maybe we need something for asterius here
15 # as well.
16 version = lib.mapAttrs (_: f: v: f (builtins.compareVersions config.compiler.version v)) {
17 eq = c: c == 0;
18 gt = c: c > 0;
19 ge = c: c >= 0;
20 lt = c: c < 0;
21 le = c: c <= 0;
22 };
23 };
24 system = cabal.os // { "is${hostMap.os}" = true; }
25 // cabal.arch // { "is${hostMap.arch}" = true; };
27in {
28 options.cabal.compiler = lib.mkOption {
29 type = lib.types.unspecified;
30 };
31 options.cabal.system = lib.mkOption {
32 type = lib.types.unspecified;
33 };
34 config.cabal = { inherit compiler system; };