diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index a857b821c257..8721a8753cd0 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -27,6 +27,26 @@ let lib.mapAttrs ( n: alias: removeDistribute (removeRecurseForDerivations (checkInPkgs n alias)) ) aliases; + + warnAlias = + msg: v: + if lib.isDerivation v then + lib.warnOnInstantiate msg v + else if lib.isAttrs v then + lib.mapAttrs (_: lib.warn msg) v + else if lib.isFunction v then + arg: lib.warn msg (v arg) + else if lib.isList v then + map (lib.warn msg) v + else + # Can’t do better than this, and a `throw` would be more + # disruptive for users… + # + # `nix search` flags up warnings already, so hopefully this won’t + # make things much worse until we have proper CI for aliases, + # especially since aliases of paths and numbers are presumably + # not common. + lib.warn msg v; in ### Deprecated aliases - for backward compatibility