haskell.nix/modules/cabal.nix
John A. Lotoski 09526c8555
Spelling, typo and whitespace fixes (#833)
* Spelling and typo fixes in doc and code comments
* Trailing whitespace or whitespace only truncation
* readTheDocs formatting corrections
2020-08-31 11:08:25 +12:00

36 lines
1.0 KiB
Nix

{ lib, config, pkgs, ... }:
let
# it also crucially depends on system, and compiler, both of which need to be resolved to the
# current system being targeted.
hostMap = import ../lib/host-map.nix pkgs.stdenv;
cabal = import ../lib/cabal-os-arch-comp.nix;
compiler = cabal.compiler // {
isGhc = true;
# this is partially a hack to support `impl(ghcjs)`.
# We set GHC == true _and_ GHCJS == true.
isGhcjs = hostMap.os == "Ghcjs";
# maybe we need something for asterius here
# as well.
version = lib.mapAttrs (_: f: v: f (builtins.compareVersions config.compiler.version v)) {
eq = c: c == 0;
gt = c: c > 0;
ge = c: c >= 0;
lt = c: c < 0;
le = c: c <= 0;
};
};
system = cabal.os // { "is${hostMap.os}" = true; }
// cabal.arch // { "is${hostMap.arch}" = true; };
in {
options.cabal.compiler = lib.mkOption {
type = lib.types.unspecified;
};
options.cabal.system = lib.mkOption {
type = lib.types.unspecified;
};
config.cabal = { inherit compiler system; };
}