Remove obsolete function addDefaultOptionValues

Changed files
+4 -28
lib
nixos
modules
services
web-servers
apache-httpd
-26
lib/options.nix
···
type = lib.types.bool;
};
-
# !!! This function will be removed because this can be done with the
-
# multiple option declarations.
-
addDefaultOptionValues = defs: opts: opts //
-
builtins.listToAttrs (map (defName:
-
{ name = defName;
-
value =
-
let
-
defValue = builtins.getAttr defName defs;
-
optValue = builtins.getAttr defName opts;
-
in
-
if isOption defValue
-
then
-
# `defValue' is an option.
-
if hasAttr defName opts
-
then builtins.getAttr defName opts
-
else defValue.default
-
else
-
# `defValue' is an attribute set containing options.
-
# So recurse.
-
if hasAttr defName opts && isAttrs optValue
-
then addDefaultOptionValues defValue optValue
-
else addDefaultOptionValues defValue {};
-
}
-
) (attrNames defs));
-
mergeDefaultOption = args: list:
if length list == 1 then head list
else if all builtins.isFunction list then x: mergeDefaultOption args (map (f: f x) list)
···
else if all builtins.isString list then lib.concatStrings list
else if all builtins.isInt list && all (x: x == head list) list then head list
else throw "Cannot merge definitions of `${showOption args.prefix}' given in ${showFiles args.files}.";
-
/* Obsolete, will remove soon. Specify an option type or apply
function instead. */
+4 -2
nixos/modules/services/web-servers/apache-httpd/default.nix
···
svcFunction =
if svc ? function then svc.function
else import "${./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix";
-
config = addDefaultOptionValues res.options
-
(if svc ? config then svc.config else svc);
+
config = (evalModules
+
{ modules = [ { options = res.options; config = svc.config or svc; } ];
+
check = false;
+
}).config;
defaults = {
extraConfig = "";
extraModules = [];