make-derivation: add check that the name is consistent with pname and version
commit2962f94fec198cd378471e2b6acc89d0af6ae226
authorPatrick Hilhorst <git@hilhorst.be>
dateMon 29 Oct 2018, 14:58 (8 years ago)
parent149a55e
pkgs/stdenv/generic/make-derivation.nix+4
@@ -82,6 +82,10 @@ rec {
8282
8383 , ... } @ attrs:
8484
85+ # Check that the name is consistent with pname and version:
86+ assert lib.lists.all (name: builtins.hasAttr name attrs) ["name" "pname" "version"]
87+ -> lib.strings.hasSuffix "${attrs.pname}-${attrs.version}" attrs.name;
88+
8589 let
8690 # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when
8791 # no package has `doCheck = true`.