on iko/ghcjs-patch-master help sign in
add more cross and docrosscheck logic
6cf6e94Moritz Angermann
builder/comp-builder.nix+3−2
@@ -16,7 +16,8 @@
16, preCheck ? null, postCheck ? null
16, preCheck ? null, postCheck ? null
17, preInstall ? null, postInstall ? null
17, preInstall ? null, postInstall ? null
18
18
19−, doCheck ? componentId.ctype == "test"
19+, doCheck ? component.doCheck || componentId.ctype == "test"
20+, doCrossCheck ? component.doCrossCheck || false
20}:
21}:
21
22
22let
23let
@@ -129,7 +130,7 @@ let
129in stdenv.mkDerivation ({
130in stdenv.mkDerivation ({
130 name = fullName;
131 name = fullName;
131
132
132− inherit src doCheck;
133+ inherit src doCheck doCrossCheck;
133
134
134 passthru = {
135 passthru = {
135 inherit (package) identifier;
136 inherit (package) identifier;
builder/default.nix+2−1
@@ -70,7 +70,8 @@ let
70
70
71 buildComp = componentId: component: comp-builder {
71 buildComp = componentId: component: comp-builder {
72 inherit componentId component package name src flags setup cabalFile patches
72 inherit componentId component package name src flags setup cabalFile patches
73− preUnpack postUnpack preConfigure postConfigure preBuild postBuild preCheck postCheck preInstall postInstall;
73+ preUnpack postUnpack preConfigure postConfigure preBuild postBuild preCheck postCheck preInstall postInstall
74+ ;
74 };
75 };
75
76
76in {
77in {
modules/package.nix+24−7
@@ -97,7 +97,7 @@ in {
97 };
97 };
98
98
99 components = let
99 components = let
100− componentType = submodule {
100+ componentType = check: submodule {
101 options = {
101 options = {
102 depends = mkOption {
102 depends = mkOption {
103 type = listOfFilteringNulls unspecified;
103 type = listOfFilteringNulls unspecified;
@@ -139,30 +139,38 @@ in {
139 type = bool;
139 type = bool;
140 default = false;
140 default = false;
141 };
141 };
142+ doCheck = mkOption {
143+ type = bool;
144+ default = check;
145+ };
146+ doCrossCheck = mkOption {
147+ type = bool;
148+ default = config.doCrossCheck;
149+ };
142 };
150 };
143 };
151 };
144 in {
152 in {
145 library = mkOption {
153 library = mkOption {
146− type = componentType;
154+ type = componentType false;
147 };
155 };
148 sublibs = mkOption {
156 sublibs = mkOption {
149− type = attrsOf componentType;
157+ type = attrsOf (componentType false);
150 default = {};
158 default = {};
151 };
159 };
152 foreignlibs = mkOption {
160 foreignlibs = mkOption {
153− type = attrsOf componentType;
161+ type = attrsOf (componentType false);
154 default = {};
162 default = {};
155 };
163 };
156 exes = mkOption {
164 exes = mkOption {
157− type = attrsOf componentType;
165+ type = attrsOf (componentType false);
158 default = {};
166 default = {};
159 };
167 };
160 tests = mkOption {
168 tests = mkOption {
161− type = attrsOf componentType;
169+ type = attrsOf (componentType config.doCheck);
162 default = {};
170 default = {};
163 };
171 };
164 benchmarks = mkOption {
172 benchmarks = mkOption {
165− type = attrsOf componentType;
173+ type = attrsOf (componentType false);
166 default = {};
174 default = {};
167 };
175 };
168 };
176 };
@@ -245,5 +253,14 @@ in {
245 type = nullOr string;
253 type = nullOr string;
246 default = null;
254 default = null;
247 };
255 };
256+ doCheck = mkOption {
257+ type = bool;
258+ default = false;
259+ };
260+ doCrossCheck = mkOption {
261+ 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.";
262+ type = bool;
263+ default = false;
264+ };
248 };
265 };
249}
266}