From 4d2e351d55c47863fd4fadafb46f63a56472faaf Mon Sep 17 00:00:00 2001 From: Luke Bailey Date: Sun, 7 Dec 2025 15:43:03 +0000 Subject: [PATCH] lib.literalExpression: add example and properly describe function arg --- lib/options.nix | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/options.nix b/lib/options.nix index a36fc2220d21..42f451bd8674 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -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: