diff options
author | benaryorg <binary@benary.org> | 2024-01-25 22:09:23 +0000 |
---|---|---|
committer | benaryorg <binary@benary.org> | 2024-02-12 17:58:48 +0000 |
commit | 8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8 (patch) | |
tree | 69953aec302762d8b48a6c908828aa84d181436d /nixos/doc/manual | |
parent | 3e72e7c01483666a4465abfeefbcd4c668c79865 (diff) | |
download | nixlib-8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8.tar nixlib-8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8.tar.gz nixlib-8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8.tar.bz2 nixlib-8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8.tar.lz nixlib-8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8.tar.xz nixlib-8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8.tar.zst nixlib-8b2d86b982c5d5c6f4c7402546d32b17eb6b07f8.zip |
pkgs.formats: toINIWithGlobalSection wrapper
The new format is based on the existing wrapper and generates an INI file with an unnamed global section at the top as is used by *stunnel* for instance. Technically the INI format is a subset of this however testing, type checking, and API guarantees profit from two separate generators. Co-authored-by: tim-tx <tim-tx@users.noreply.github.com> Signed-off-by: benaryorg <binary@benary.org>
Diffstat (limited to 'nixos/doc/manual')
-rw-r--r-- | nixos/doc/manual/development/settings-options.section.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/doc/manual/development/settings-options.section.md b/nixos/doc/manual/development/settings-options.section.md index 3a4800742b04..71ec9bbc8892 100644 --- a/nixos/doc/manual/development/settings-options.section.md +++ b/nixos/doc/manual/development/settings-options.section.md @@ -73,6 +73,34 @@ have a predefined type and string generator already declared under It returns a set with INI-specific attributes `type` and `generate` as specified [below](#pkgs-formats-result). + The type of the input is an *attrset* of sections; key-value pairs where + the key is the section name and the value is the corresponding content + which is also an *attrset* of key-value pairs for the actual key-value + mappings of the INI format. + The values of the INI atoms are subject to the above parameters (e.g. lists + may be transformed into multiple key-value pairs depending on + `listToValue`). + +`pkgs.formats.iniWithGlobalSection` { *`listsAsDuplicateKeys`* ? false, *`listToValue`* ? null, \.\.\. } + +: A function taking an attribute set with values + + `listsAsDuplicateKeys` + + : A boolean for controlling whether list values can be used to + represent duplicate INI keys + + `listToValue` + + : A function for turning a list of values into a single value. + + It returns a set with INI-specific attributes `type` and `generate` + as specified [below](#pkgs-formats-result). + The type of the input is an *attrset* of the structure + `{ sections = {}; globalSection = {}; }` where *sections* are several + sections as with *pkgs.formats.ini* and *globalSection* being just a single + attrset of key-value pairs for a single section, the global section which + preceedes the section definitions. `pkgs.formats.toml` { } |