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/trivial.nix | |
parent | 224c1952085bd30f980271ee80a86c91caa09f8d (diff) |
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/trivial.nix')
-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 dee7eca9699a0..f4a8f0d9bec57 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 |