I would love to have a built-in for issuing warnings (same type as builtins.trace) that issues warnings after the build. Would would look like this:
$ cat default.nix
let pkgs = import <nixpkgs> {}; in builtins.warn "bad idea" pkgs.nodejs
$ nix-build
these derivations will be built: # stderr
/nix/store/ylmml9yxzjlcpvpb5bql2kjx2zkknfz3-hello.drv # stderr
building '/nix/store/ylmml9yxzjlcpvpb5bql2kjx2zkknfz3-hello.drv'... # stderr
...
WARNING: bad idea # stderr, yellow
/nix/store/.....-hello # stdout
Warnings would be very useful when e.g. some attribute is deprecated, when some hack is not needed anymore (e.g. new Nix version/nixpkgs version), etc. Using trace is tricky because it often just gets lost at the beginning of the build (or whenever it's being evaluated).
I would love to have a built-in for issuing warnings (same type as
builtins.trace
) that issues warnings after the build. Would would look like this:Warnings would be very useful when e.g. some attribute is deprecated, when some hack is not needed anymore (e.g. new Nix version/nixpkgs version), etc. Using
trace
is tricky because it often just gets lost at the beginning of the build (or whenever it's being evaluated).