diff options
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r-- | lib/trivial.nix | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index 6eb1fb3a5b1..c8ef5599ccd 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -158,7 +158,7 @@ rec { seq deepSeq genericClosure; - ## nixpks version strings + ## nixpkgs version strings /* Returns the current full nixpkgs version number. */ version = release + versionSuffix; @@ -171,7 +171,7 @@ rec { On each release the first letter is bumped and a new animal is chosen starting with that new letter. */ - codeName = "Nightingale"; + codeName = "Porcupine"; /* Returns the current nixpkgs version suffix as string. */ versionSuffix = @@ -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 @@ -291,15 +297,18 @@ rec { # Usage: # { # foo = lib.warn "foo is deprecated" oldFoo; + # bar = lib.warnIf (bar == "") "Empty bar is deprecated" bar; # } # # TODO: figure out a clever way to integrate location information from # something like __unsafeGetAttrPos. warn = msg: builtins.trace "[1;31mwarning: ${msg}[0m"; + warnIf = cond: msg: if cond then warn msg else id; + info = msg: builtins.trace "INFO: ${msg}"; - showWarnings = warnings: res: lib.fold (w: x: warn w x) res warnings; + showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings; ## Function annotations |