query
On this page

literalExpression

lib.literalExpression

Docs pulled from | This Revision | 35 minutes ago


For use in the defaultText and example option attributes. Causes the given string to be rendered verbatim in the documentation as Nix code. This is necessary for complex values, e.g. functions, or values that depend on other values or packages.

Examples

literalExpression usage example

llvmPackages = mkOption {
  type = types.str;
  description = ''
    Version of llvm packages to use for
    this module
  '';
  example = literalExpression ''
    llvmPackages = pkgs.llvmPackages_20;
  '';
};

Inputs

text

The text to render as a Nix expression

(lib.options.literalExpression)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

literalExpression =
    text:
    if !isString text then
      throw "literalExpression expects a string."
    else
      {
        _type = "literalExpression";
        inherit text;
      };