@@ -13,39 +13,22 @@
13# tests = { "..." = { depends = ... }; ... };
13# tests = { "..." = { depends = ... }; ... };
16+{ parentConfig, mod_args, listOfFilteringNulls, componentOptions, packageOptions }:
16{ lib, config, pkgs, haskellLib, ... }:
17{ lib, config, pkgs, haskellLib, ... }:
19with types;
20with types;
22− # This is just like listOf, except that it filters out all null elements.
23− listOfFilteringNulls = elemType: listOf elemType // {
24− # Mostly copied from nixpkgs/lib/types.nix
26− map (x: x.value) (filter (x: x ? value && x.value != null) (concatLists (imap1 (n: def:
27− if isList def.value then
30− (loc ++ ["[definition ${toString n}-entry ${toString m}]"])
32− [{ inherit (def) file; value = def'; }]
36− throw "The option value `${showOption loc}` in `${def.file}` is not a list.") defs)));
39 # This is how the Nix expressions generated by *-to-nix receive
23 # This is how the Nix expressions generated by *-to-nix receive
40 # their flags argument.
24 # their flags argument.
41− config._module.args.flags = config.flags;
25+ config._module.args = mod_args // { flags = config.flags; };
43− options = {
27+ options = (packageOptions parentConfig) // {
44 # TODO: Add descriptions to everything.
28 # TODO: Add descriptions to everything.
45 flags = mkOption {
29 flags = mkOption {
46 type = attrsOf bool;
30 type = attrsOf bool;
49 package = {
32 package = {
50 specVersion = mkOption {
33 specVersion = mkOption {
51 type = str;
34 type = str;
@@ -98,7 +81,8 @@ in {
99 components = let
82 components = let
100 componentType = submodule {
83 componentType = submodule {
101− options = {
84+ # add the shared componentOptions
85+ options = (componentOptions config) // {
102 depends = mkOption {
86 depends = mkOption {
103 type = listOfFilteringNulls unspecified;
87 type = listOfFilteringNulls unspecified;
104 default = [];
88 default = [];
@@ -119,43 +103,6 @@ in {
119 type = listOfFilteringNulls unspecified;
103 type = listOfFilteringNulls unspecified;
120 default = [];
104 default = [];
122− configureFlags = mkOption {
123− type = listOfFilteringNulls str;
124− default = config.configureFlags;
126− setupBuildFlags = mkOption {
127− type = listOfFilteringNulls str;
128− default = config.setupBuildFlags;
130− setupTestFlags = mkOption {
131− type = listOfFilteringNulls str;
132− default = config.setupTestFlags;
134− setupInstallFlags = mkOption {
135− type = listOfFilteringNulls str;
136− default = config.setupInstallFlags;
138− setupHaddockFlags = mkOption {
139− type = listOfFilteringNulls str;
140− default = config.setupHaddockFlags;
142− doExactConfig = mkOption {
144− default = config.doExactConfig;
146− doCheck = mkOption {
148− default = config.doCheck;
150− doCrossCheck = mkOption {
152− default = config.doCrossCheck;
154− doHaddock = mkOption {
155− description = "Enable building of the Haddock documentation from the annotated Haskell source code.";
157− default = config.doHaddock;
@@ -224,96 +171,6 @@ in {
224 type = listOf (either unspecified path);
171 type = listOf (either unspecified path);
225 default = [];
172 default = [];
227− configureFlags = mkOption {
228− type = listOfFilteringNulls str;
231− setupBuildFlags = mkOption {
232− type = listOfFilteringNulls str;
235− setupTestFlags = mkOption {
236− type = listOfFilteringNulls str;
239− setupInstallFlags = mkOption {
240− type = listOfFilteringNulls str;
243− setupHaddockFlags = mkOption {
244− type = listOfFilteringNulls str;
247− preUnpack = mkOption {
248− type = nullOr lines;
251− postUnpack = mkOption {
252− type = nullOr string;
255− preConfigure = mkOption {
256− type = nullOr string;
259− postConfigure = mkOption {
260− type = nullOr string;
263− preBuild = mkOption {
264− type = nullOr string;
267− postBuild = mkOption {
268− type = nullOr string;
271− preCheck = mkOption {
272− type = nullOr string;
275− postCheck = mkOption {
276− type = nullOr string;
279− preInstall = mkOption {
280− type = nullOr string;
283− postInstall = mkOption {
284− type = nullOr string;
287− preHaddock = mkOption {
288− type = nullOr string;
291− postHaddock = mkOption {
292− type = nullOr string;
295− shellHook = mkOption {
296− type = nullOr string;
299− doExactConfig = mkOption {
303− doCheck = mkOption {
307− doCrossCheck = mkOption {
308− description = "Run doCheck also in cross compilation settings. This can be tricky as the test logic must know how to run the tests on the target.";
312− doHaddock = mkOption {
313− description = "Enable building of the Haddock documentation from the annotated Haskell source code.";
319 # This has one quirk. Manually setting options on the all component
176 # This has one quirk. Manually setting options on the all component