on iko/ghcjs-patch-master help sign in
Use mkForce in with-package test, and add a comment about the quirk.
70f01c2Will Fancher
modules/package.nix+10
@@ -284,5 +284,15 @@ in {
284 };
284 };
285 };
285 };
286
286
287+ # This has one quirk. Manually setting options on the all component
288+ # will be considered a conflict. This is almost always fine; most
289+ # settings should be modified in either the package options, or an
290+ # individual component's options. When this isn't sufficient,
291+ # mkForce is a reasonable workaround.
292+ #
293+ # An alternative solution to mkForce for many of the options where
294+ # this is relevant would be to switch from the bool type to
295+ # something like an anyBool type, which would merge definitions by
296+ # returning true if any is true.
287 config.components.all = lib.mkMerge (haskellLib.getAllComponents config);
297 config.components.all = lib.mkMerge (haskellLib.getAllComponents config);
288}
298}
test/with-packages/default.nix+10−9
@@ -25,7 +25,7 @@ let
25 # vary component config for tests
25 # vary component config for tests
26 {
26 {
27 packages.test-with-packages.components = {
27 packages.test-with-packages.components = {
28− all.doExactConfig = false; # the default
28+ all.doExactConfig = mkForce false; # the default; use force because of quirk in all. See package.nix
29 library.doExactConfig = true; # not the default
29 library.doExactConfig = true; # not the default
30 };
30 };
31 }
31 }
@@ -68,14 +68,15 @@ in
68 '';
68 '';
69
69
70 meta.platforms = platforms.all;
70 meta.platforms = platforms.all;
71−} // {
71+ passthru = {
72− # Used for debugging with nix repl
72+ # Used for debugging with nix repl
73− inherit packages pkgSet;
73+ inherit packages pkgSet;
74
74
75− # Used for testing externally with nix-shell (../tests.sh).
75+ # Used for testing externally with nix-shell (../tests.sh).
76− # This just adds cabal-install to the existing shells.
76+ # This just adds cabal-install to the existing shells.
77− test-shell = addCabalInstall packages.test-with-packages.components.all;
77+ test-shell = addCabalInstall packages.test-with-packages.components.all;
78
78
79− # A variant of test-shell with the component option doExactConfig enabled
79+ # A variant of test-shell with the component option doExactConfig enabled
80− test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
80+ test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
81+ };
81}
82}