Skip to content

Commit 17ead94

Browse files
ElvishJerriccoangerman
authored andcommitted
Use config to set componentType defaults.
1 parent a7568a0 commit 17ead94

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

modules/package.nix

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ in {
9797
};
9898

9999
components = let
100-
componentType = defaults: submodule {
100+
componentType = submodule {
101101
options = {
102102
depends = mkOption {
103103
type = listOfFilteringNulls unspecified;
104-
default = defaults.depends or [];
104+
default = [];
105105
};
106106
libs = mkOption {
107107
type = listOfFilteringNulls (nullOr package);
@@ -137,11 +137,11 @@ in {
137137
};
138138
doExactConfig = mkOption {
139139
type = bool;
140-
default = false;
140+
default = config.doExactConfig;
141141
};
142142
doCheck = mkOption {
143143
type = bool;
144-
default = defaults.doCheck or false;
144+
default = config.doCheck;
145145
};
146146
doCrossCheck = mkOption {
147147
type = bool;
@@ -151,30 +151,30 @@ in {
151151
};
152152
in {
153153
library = mkOption {
154-
type = componentType {};
154+
type = componentType;
155155
};
156156
sublibs = mkOption {
157-
type = attrsOf (componentType {});
157+
type = attrsOf componentType;
158158
default = {};
159159
};
160160
foreignlibs = mkOption {
161-
type = attrsOf (componentType {});
161+
type = attrsOf componentType;
162162
default = {};
163163
};
164164
exes = mkOption {
165-
type = attrsOf (componentType {});
165+
type = attrsOf componentType;
166166
default = {};
167167
};
168168
tests = mkOption {
169-
type = attrsOf (componentType { inherit (config) doCheck; });
169+
type = attrsOf componentType;
170170
default = {};
171171
};
172172
benchmarks = mkOption {
173-
type = attrsOf (componentType {});
173+
type = attrsOf componentType;
174174
default = {};
175175
};
176176
all = mkOption {
177-
type = componentType {};
177+
type = componentType;
178178
description = "The merged dependencies of all other components";
179179
};
180180
};
@@ -269,6 +269,10 @@ in {
269269
type = nullOr string;
270270
default = null;
271271
};
272+
doExactConfig = mkOption {
273+
type = bool;
274+
default = false;
275+
};
272276
doCheck = mkOption {
273277
type = bool;
274278
default = false;

0 commit comments

Comments
 (0)