@@ -598,6 +598,32 @@ rec {
598598 (mergeFn config)));
599599 };
600600
601+ /* Single "from" version of mkMergedOptionModule.
602+ Return a module that causes a warning to be shown if the "from" option is
603+ defined; the defined value can be used in the "mergeFn" to set the "to"
604+ value.
605+ This function can be used to change an option into another that has a
606+ different type.
607+
608+ "mergeFn" takes the module "config" as a parameter and must return a value of
609+ "to" option type.
610+
611+ mkChangedOptionModule [ "a" "b" "c" ] [ "x" "y" "z" ]
612+ (config:
613+ let value = getAttrFromPath [ "a" "b" "c" ] config;
614+ in
615+ if value > 100 then "high"
616+ else "normal")
617+
618+ - options.a.b.c is a removed int option
619+ - options.x.y.z is a new str option that supersedes a.b.c
620+
621+ This show a warning if a.b.c is set, and set the value of x.y.z to the
622+ result of the change function
623+ */
624+ mkChangedOptionModule = from: to: changeFn:
625+ mkMergedOptionModule [ from ] to changeFn;
626+
601627 /* Like ‘mkRenamedOptionModule’, but doesn't show a warning. */
602628 mkAliasOptionModule = from: to: doRename {
603629 inherit from to;