query
On this page

warnOnInstantiate

lib.warnOnInstantiate

Docs pulled from | This Revision | 28 minutes ago


Wrap a derivation such that instantiating it produces a warning.

All attributes will be wrapped with lib.warn except from .meta, .name, and .type which are used by nix search, and .outputName which avoids double warnings with nix-instantiate and nix-build.

Inputs

msg
The warning message to emit (via lib.warn).
drv
The derivation to wrap.

Examples

lib.derivations.warnOnInstantiate usage example

{
  myPackage = warnOnInstantiate "myPackage has been renamed to my-package" my-package;
}
(lib.derivations.warnOnInstantiate)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

warnOnInstantiate =
    msg: drv:
    let
      drvToWrap = removeAttrs drv [
        "meta"
        "name"
        "type"
        "outputName"
      ];
    in
    drv // mapAttrs (_: lib.warn msg) drvToWrap;