@@ -19,6 +19,8 @@ with lib;
19with types;
19with types;
22+ haskellLib = let hl = import ../lib { inherit lib; haskellLib = hl; }; in hl;
22 # This is just like listOf, except that it filters out all null elements.
24 # This is just like listOf, except that it filters out all null elements.
23 listOfFilteringNulls = elemType: listOf elemType // {
25 listOfFilteringNulls = elemType: listOf elemType // {
24 # Mostly copied from nixpkgs/lib/types.nix
26 # Mostly copied from nixpkgs/lib/types.nix
@@ -97,11 +99,11 @@ in {
99 components = let
101 components = let
100− componentType = check: submodule {
102+ componentType = defaults: submodule {
101 options = {
103 options = {
102 depends = mkOption {
104 depends = mkOption {
103 type = listOfFilteringNulls unspecified;
105 type = listOfFilteringNulls unspecified;
104− default = [];
106+ default = defaults.depends or [];
106 libs = mkOption {
108 libs = mkOption {
107 type = listOfFilteringNulls (nullOr package);
109 type = listOfFilteringNulls (nullOr package);
@@ -141,7 +143,7 @@ in {
142 doCheck = mkOption {
144 doCheck = mkOption {
143 type = bool;
145 type = bool;
144− default = check;
146+ default = defaults.doCheck or false;
146 doCrossCheck = mkOption {
148 doCrossCheck = mkOption {
147 type = bool;
149 type = bool;
@@ -151,35 +153,38 @@ in {
153 library = mkOption {
155 library = mkOption {
154− type = componentType false;
156+ type = componentType {};
156 sublibs = mkOption {
158 sublibs = mkOption {
157− type = attrsOf (componentType false);
159+ type = attrsOf (componentType {});
158 default = {};
160 default = {};
160 foreignlibs = mkOption {
162 foreignlibs = mkOption {
161− type = attrsOf (componentType false);
163+ type = attrsOf (componentType {});
162 default = {};
164 default = {};
164 exes = mkOption {
166 exes = mkOption {
165− type = attrsOf (componentType false);
167+ type = attrsOf (componentType {});
166 default = {};
168 default = {};
168 tests = mkOption {
170 tests = mkOption {
169− type = attrsOf (componentType config.doCheck);
171+ type = attrsOf (componentType { inherit (config) doCheck; });
170 default = {};
172 default = {};
172 benchmarks = mkOption {
174 benchmarks = mkOption {
173− type = attrsOf (componentType false);
175+ type = attrsOf (componentType {});
174 default = {};
176 default = {};
176− all = mkOption {
178+ all = let
177− type = componentType false;
179+ subComponentsDepends = sub: concatLists
178− default = let
180+ (mapAttrsToList (_: c: c.depends or []) config.components.${sub} or {});
179− componentTypes = [ "library" "sublibs" "foreignlibs" "exes" "tests" "benchmarks" ];
181+ default = {
180− in {
182+ depends = config.components.library.depends ++
181− depends = mkMerge (map (c: config.components.${c}.depends or []) componentTypes);
183+ concatMap subComponentsDepends haskellLib.subComponentTypes;
186+ type = componentType default;
183 defaultText = "The merged dependencies of all other components";
188 defaultText = "The merged dependencies of all other components";