mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
lib.literalExpression: add example and properly describe function arg
This commit is contained in:
@@ -672,11 +672,30 @@ rec {
|
||||
is necessary for complex values, e.g. functions, or values that depend on
|
||||
other values or packages.
|
||||
|
||||
# Examples
|
||||
:::{.example}
|
||||
## `literalExpression` usage example
|
||||
|
||||
```nix
|
||||
llvmPackages = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Version of llvm packages to use for
|
||||
this module
|
||||
'';
|
||||
example = literalExpression ''
|
||||
llvmPackages = pkgs.llvmPackages_20;
|
||||
'';
|
||||
};
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
# Inputs
|
||||
|
||||
`text`
|
||||
|
||||
: 1\. Function argument
|
||||
: The text to render as a Nix expression
|
||||
*/
|
||||
literalExpression =
|
||||
text:
|
||||
|
||||
Reference in New Issue
Block a user