Loading nixos/doc/manual/development/settings-options.section.md +31 −0 Original line number Diff line number Diff line Loading @@ -358,6 +358,37 @@ have a predefined type and string generator already declared under : 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) Loading Loading
nixos/doc/manual/development/settings-options.section.md +31 −0 Original line number Diff line number Diff line Loading @@ -358,6 +358,37 @@ have a predefined type and string generator already declared under : 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) Loading