From 2962f94fec198cd378471e2b6acc89d0af6ae226 Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Mon, 29 Oct 2018 14:58:12 +0100 Subject: [PATCH] make-derivation: add check that the name is consistent with pname and version --- pkgs/stdenv/generic/make-derivation.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index dcf73a38a1d..6f31e09b125 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -82,6 +82,10 @@ rec { , ... } @ attrs: + # Check that the name is consistent with pname and version: + assert lib.lists.all (name: builtins.hasAttr name attrs) ["name" "pname" "version"] + -> lib.strings.hasSuffix "${attrs.pname}-${attrs.version}" attrs.name; + let # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when # no package has `doCheck = true`.