on iko/ghcjs-patch-master help sign in
Use mkForce in with-package test, and add a comment about the quirk.
commit70f01c2029b3020c68ae22eef6542c3e7610807d authorWill Fancher <elvishjerricco@gmail.com> dateSat 2 Feb 2019, 00:23 (8 years ago) parent17ead94
2 files changed+20−9
modules/package.nix+10 test/with-packages/default.nix+10−9
modules/package.nix+10
@@ -284,5 +284,15 @@ in {
284284 };
285285 };
286286
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.
287297 config.components.all = lib.mkMerge (haskellLib.getAllComponents config);
288298}
test/with-packages/default.nix+10−9
@@ -25,7 +25,7 @@ let
2525 # vary component config for tests
2626 {
2727 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
2929 library.doExactConfig = true; # not the default
3030 };
3131 }
@@ -68,14 +68,15 @@ in
6868 '';
6969
7070 meta.platforms = platforms.all;
71−} // {
72− # Used for debugging with nix repl
73− inherit packages pkgSet;
71+ passthru = {
72+ # Used for debugging with nix repl
73+ inherit packages pkgSet;
7474
75− # Used for testing externally with nix-shell (../tests.sh).
76− # This just adds cabal-install to the existing shells.
77− test-shell = addCabalInstall packages.test-with-packages.components.all;
75+ # Used for testing externally with nix-shell (../tests.sh).
76+ # This just adds cabal-install to the existing shells.
77+ test-shell = addCabalInstall packages.test-with-packages.components.all;
7878
79− # A variant of test-shell with the component option doExactConfig enabled
80− test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
79+ # A variant of test-shell with the component option doExactConfig enabled
80+ test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
81+ };
8182}