nixos/doc: add documentation for `formats.pythonVars`

h7x4 b7cdcad8 5ca4c89b

Changed files
+31
nixos
doc
manual
+31
nixos/doc/manual/development/settings-options.section.md
···
: Outputs the xml with header.
`pkgs.formats.cdn` { }
: A function taking an empty attribute set (for future extensibility)
···
: Outputs the xml with header.
+
`pkgs.formats.pythonVars` { }
+
+
: A function taking an empty attribute set (for future extensibility)
+
and returning a set with python variable specific attributes `type`, `lib`, and
+
`generate` as specified [below](#pkgs-formats-result).
+
+
The `lib` attribute contains functions to be used in settings, for
+
generating special Python values:
+
+
`mkRaw pythonCode`
+
+
: Outputs the given string as raw Python code
+
+
`_imports`
+
+
`_imports` is a special value you can set to specify additional modules to be
+
imported on top of the file.
+
+
`Example usage:`
+
+
```nix
+
let
+
format = pkgs.formats.pythonVars { };
+
in {
+
_imports = [ "re" ];
+
+
conditional = format.lib.mkRaw "1 if True else 2";
+
function_result = format.lib.mkRaw "re.findall(r'\\bf[a-z]*', 'which foot or hand fell fastest')";
+
}
+
```
+
`pkgs.formats.cdn` { }
: A function taking an empty attribute set (for future extensibility)