diff options
author | Dan Peebles <pumpkin@me.com> | 2016-08-15 13:54:23 -0400 |
---|---|---|
committer | Dan Peebles <pumpkin@me.com> | 2016-08-15 13:54:23 -0400 |
commit | 4dfdb27e001eceb66170757dabc0d7e3ed61ca3d (patch) | |
tree | 5769db621d8dbba84225160a0f2fbf08dad42af4 | |
parent | ef15f01a43eecf374705ca9cec46c95867f61239 (diff) | |
download | nixlib-4dfdb27e001eceb66170757dabc0d7e3ed61ca3d.tar nixlib-4dfdb27e001eceb66170757dabc0d7e3ed61ca3d.tar.gz nixlib-4dfdb27e001eceb66170757dabc0d7e3ed61ca3d.tar.bz2 nixlib-4dfdb27e001eceb66170757dabc0d7e3ed61ca3d.tar.lz nixlib-4dfdb27e001eceb66170757dabc0d7e3ed61ca3d.tar.xz nixlib-4dfdb27e001eceb66170757dabc0d7e3ed61ca3d.tar.zst nixlib-4dfdb27e001eceb66170757dabc0d7e3ed61ca3d.zip |
lib.{warn, info}: add simple helpers
See also https://github.com/NixOS/nix/issues/749.
-rw-r--r-- | lib/trivial.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index 21642ca0bdc1..25ce35570fdf 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -98,4 +98,19 @@ rec { */ importJSON = path: builtins.fromJSON (builtins.readFile path); + + /* See https://github.com/NixOS/nix/issues/749. Eventually we'd like these + to expand to Nix builtins that carry metadata so that Nix can filter out + the INFO messages without parsing the message string. + + Usage: + { + foo = lib.warn "foo is deprecated" oldFoo; + } + + TODO: figure out a clever way to integrate location information from + something like __unsafeGetAttrPos. + */ + warn = msg: builtins.trace "WARNING: ${msg}"; + info = msg: builtins.trace "INFO: ${msg}"; } |