lib: add importTOML

Complements the `lib.importJSON`. `builtins.readTOML` has been
introduced in Nix 2.1.
This commit is contained in:
zimbatm 2020-08-16 15:39:52 +02:00
parent 607509ac8f
commit 947a7d33f9
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7
2 changed files with 7 additions and 1 deletions

View File

@ -66,7 +66,7 @@ let
stringLength sub substring tail;
inherit (trivial) id const pipe concat or and bitAnd bitOr bitXor
bitNot boolToString mergeAttrs flip mapNullable inNixShell min max
importJSON warn info showWarnings nixpkgsVersion version mod compare
importJSON importTOML warn info showWarnings nixpkgsVersion version mod compare
splitByAndCompare functionArgs setFunctionArgs isFunction toHexString toBaseDigits;
inherit (fixedPoints) fix fix' converge extends composeExtensions
makeExtensible makeExtensibleWithCustomName;

View File

@ -281,6 +281,12 @@ rec {
importJSON = path:
builtins.fromJSON (builtins.readFile path);
/* Reads a TOML file.
Type :: path -> any
*/
importTOML = path:
builtins.fromTOML (builtins.readFile path);
## Warnings