diff options
author | Samuel Shuert <me@thecoded.prof> | 2024-06-07 17:15:50 -0400 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2024-06-13 03:11:56 +0200 |
commit | 64f0f7a448ae743b7393a150bdc47553ea75b66c (patch) | |
tree | eb68cd2c89f987da22b4cd056da7447ef3256225 /lib | |
parent | 224c1952085bd30f980271ee80a86c91caa09f8d (diff) | |
download | nixlib-64f0f7a448ae743b7393a150bdc47553ea75b66c.tar nixlib-64f0f7a448ae743b7393a150bdc47553ea75b66c.tar.gz nixlib-64f0f7a448ae743b7393a150bdc47553ea75b66c.tar.bz2 nixlib-64f0f7a448ae743b7393a150bdc47553ea75b66c.tar.lz nixlib-64f0f7a448ae743b7393a150bdc47553ea75b66c.tar.xz nixlib-64f0f7a448ae743b7393a150bdc47553ea75b66c.tar.zst nixlib-64f0f7a448ae743b7393a150bdc47553ea75b66c.zip |
lib.trivial.importTOML: add example
Friend came to me with misunderstanding of how this function works. After discussion we came to the conclusion having an example would have prevented this.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/trivial.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index dee7eca9699a..f4a8f0d9bec5 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -642,6 +642,35 @@ in { /** Reads a TOML file. + # Examples + :::{.example} + ## `lib.trivial.importTOML` usage example + + example.toml + ```toml + title = "TOML Example" + + [hello] + world = "foo" + + [hello.bar] + foobar = true + ``` + + ```nix + importTOML ./example.toml + => { + title = "TOML Example"; + hello = { + world = "foo"; + bar = { + foobar = true; + }; + }; + } + ``` + + ::: # Inputs |