Commit graph

6 commits

Author SHA1 Message Date
Profpatsch ea412cd5a1 lib/generators: add toKeyValue & mkKeyValueLine (#20903)
generators for the common use case of simple config files which hold keys and
values. Used in the implementation for toINI.
2016-12-04 22:11:24 +01:00
Profpatsch 26eb10e771 lib: add generator functions for toJSON & toYAML
They both reference the toJSON builtin, so we get semantic identifiers
that express the intent of the generation.
Both should be able to map each nix value (minus functions) to the
destination config files.

Includes two invocation unit tests.
2016-11-17 23:16:24 +01:00
Profpatsch 61311665cb lib: add ini configuration generator
Many configurations are INI-style files. Attribute sets can be mapped
rather painlessly to the INI format.
This adds a function toINI inside a new generators library section.
Also, unit tests for the default values are provided.
2016-11-17 19:46:41 +01:00
Christian Zagrodnick ce96057588 add helper to lib/attrsets: hasAttrByPath 2015-12-07 11:04:14 +01:00
Christian Zagrodnick 1cdacc6aa2 lib/strings: add a toInt helper (close #11242)
While the function itself is pretty easy, it's not straitforward to find a way to convert string to int with nix.
2015-11-25 08:50:02 +01:00
Eelco Dolstra 5fef92c4a0 Move pkgs/lib/ to lib/ 2013-10-10 13:28:21 +02:00
Renamed from pkgs/lib/tests.nix (Browse further)