tests/port-names.nix
A bare port, (for pkgs.X [ … ]), is keyed by the pname of pkgs.X (ports/default.nix, makeOverlay), so it lands on pkgsFilc.<pname>. When that is not X, pkgsFilc.X may silently not carry the port. This check fails when the two attributes are different derivations, or when only one of them is marked broken. Aliases of one derivation (libkrb5 for krb5) pass, and so do explicitly named ports ({ bash = for pkgs.bash … }), which are keyed by their name.
The bare ports are found in the port lists' text: the (for pkgs.X spelling, outside comments.
λpkgs, pkgsFilc
let
λx
let
in
in
pkgs.runCommand"port-names-check" { }
failures ≡ [ ]
→
else
echo "Bare ports that land on another attribute than the one written:"
${lib.concatMapStringsr: "echo ' (for pkgs.${r.x} …) lands on pkgsFilc.${r.key}, and ${r.why}'\n" failures}
echo "Name the port as its attribute ({ ${lib.headfailures.x} = for pkgs.${lib.headfailures.x} [ … ]; }) or write the attribute it lands on."
exit 1