query
On this page

mkRenamedOptionModule

lib.mkRenamedOptionModule

Docs pulled from | This Revision | 29 minutes ago


Nixpkgs manual

Returns a module that causes a warning to be shown if the specified "from" option is defined; the defined value is however forwarded to the "to" option. This can be used to rename options while providing backward compatibility. For example,

mkRenamedOptionModule [ "boot" "copyKernels" ] [ "boot" "loader" "grub" "copyKernels" ]

forwards any definitions of boot.copyKernels to boot.loader.grub.copyKernels while printing a warning.

This also copies over the priority from the aliased option to the non-aliased option.

Inputs

from

The "from" option path as list of strings. Option must not exist in the current module set.

to

The "to" option path as list of strings. Option must already exist in the current module set.

Limitations

  • The "to" option must already be declared.
  • The "from" option should not be declared, as this function will declare it.
  • "to" Options whose types don't support merging at any level of their structure (like types.raw, or types.attrsOf types.raw where the attribute values can't merge) are not well-supported because this function wraps aliased definitions in mkMerge.

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

mkRenamedOptionModule =
    from: to:
    doRename {
      inherit from to;
      visible = false;
      warn = true;
      use = trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'.";
    };