-
Notifications
You must be signed in to change notification settings - Fork 244
/
Copy pathproject-common.nix
92 lines (92 loc) · 2.93 KB
/
project-common.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{ lib, config, pkgs, ... }:
with lib;
with lib.types;
{
_file = "haskell.nix/modules/project-common.nix";
options = {
# Used by callCabalProjectToNix and callStackToNix
name = mkOption {
type = nullOr str;
default = "haskell-project"; # TODO figure out why `config.src.name or null` breaks hix;
description = "Optional name for better error messages";
};
src = mkOption {
type = either path package;
};
crossPlatforms = mkOption {
type = unspecified;
default = _p: [ ];
};
# Default shell arguments
shell = mkOption {
type = submodule [
(import ./shell.nix { projectConfig = config; })
{ _module.args = { inherit (pkgs.haskell-nix) haskellLib; }; }
];
default = { };
description = ''
Arguments to use for the default shell `p.shell` (these are passed to p.shellFor).
For instance to include `cabal` and `ghcjs` support use
shell = { tools.cabal = {}; crossPlatforms = p: [ p.ghcjs ]; }
'';
};
# Default flake arguments
flake = mkOption {
type = submodule [
(import ./flake.nix { projectConfig = config; })
{ _module.args = { inherit (pkgs.haskell-nix) haskellLib; }; }
];
default = { };
description = ''
Default arguments to use for the `p.flake`.
'';
};
evalSystem = mkOption {
type = str;
default = pkgs.pkgsBuildBuild.stdenv.system;
description = ''
Specifies the system on which `cabal` and `nix-tools` should run.
If not specified the `pkgsBuildBuild` system will be used.
If there are no builders for the `pkgsBuildBuild` system
specifying a system for which there are builders will
allow the evaluation of the haskell project to work.
'';
};
evalPackages = mkOption {
type = attrs;
default =
if pkgs.pkgsBuildBuild.stdenv.system == config.evalSystem
then pkgs.pkgsBuildBuild
else
import pkgs.path {
system = config.evalSystem;
overlays = pkgs.overlays;
};
description = ''
Packages used to run `cabal` and `nix-tools`.
This will default to `pkgs.pkgsBuildBuild` if it
matches the `evalSystem` (or if `evalSystem` was
not specified).
If a different `evalSystem` was requested, `evalPackages` will
default to be:
import pkgs.path {
system = config.evalSystem;
overlays = pkgs.overlays;
};
'';
};
hsPkgs = lib.mkOption {
type = lib.types.unspecified;
};
# Used by stack and cabal projects via
# - ./lib/call-cabal-project-to-nix.nix
# - ./lib/call-stack-to-nix.nix
ignorePackageYaml = mkOption {
type = bool;
default = false;
description = ''
If set, prevents nix-tools from attempting to load package.yaml even if it is present.
'';
};
};
}