From 9d7c57afc4ed9b73c8dfcc09caf503ed9513fde1 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sun, 29 Apr 2018 17:44:18 -0500 Subject: [PATCH] aliases: add check if alias still exists in all-packages.nix If an alias is already defined in all-packages.nix, we want to throw an error to make it obvious that something is wrong. Otherwise there is no way to realize that the alias is shadowing the real definition. --- pkgs/top-level/aliases.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 74beaa81ea0..6f2ebeddb2d 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -17,8 +17,17 @@ let dontDistribute alias else alias; + # Make sure that we are not shadowing something from + # all-packages.nix. + checkInPkgs = n: alias: if builtins.hasAttr n self + then throw "Alias ${n} is still in all-packages.nix" + else alias; + mapAliases = aliases: - lib.mapAttrs (n: alias: removeDistribute (removeRecurseForDerivations alias)) aliases; + lib.mapAttrs (n: alias: removeDistribute + (removeRecurseForDerivations + (checkInPkgs n alias))) + aliases; in ### Deprecated aliases - for backward compatibility