diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-11-04 08:49:24 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2018-11-04 08:49:24 +0100 |
commit | cb4ff927a15a62fa5b4131eb912df407f6aac3af (patch) | |
tree | 6d8a27b9db36cc2dae09526c6c27785e26c59d09 /pkgs/stdenv/generic | |
parent | 64d50a00991983e90d6a22f39d03b028602e34d6 (diff) | |
parent | 6e052567047166460db229074e48d7e6c393957e (diff) | |
download | nixpkgs-cb4ff927a15a62fa5b4131eb912df407f6aac3af.tar nixpkgs-cb4ff927a15a62fa5b4131eb912df407f6aac3af.tar.gz nixpkgs-cb4ff927a15a62fa5b4131eb912df407f6aac3af.tar.bz2 nixpkgs-cb4ff927a15a62fa5b4131eb912df407f6aac3af.tar.lz nixpkgs-cb4ff927a15a62fa5b4131eb912df407f6aac3af.tar.xz nixpkgs-cb4ff927a15a62fa5b4131eb912df407f6aac3af.tar.zst nixpkgs-cb4ff927a15a62fa5b4131eb912df407f6aac3af.zip |
Merge master into staging-next
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 08a914787c3..9926a13190f 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -12,7 +12,9 @@ rec { # * https://nixos.org/nix/manual/#ssec-derivation # Explanation about derivations in general mkDerivation = - { name ? "" + { name ? if attrs ? pname && attrs ? version + then "${attrs.pname}-${attrs.version}" + else "" # These types of dependencies are all exhaustively documented in # the "Specifying Dependencies" section of the "Standard @@ -65,6 +67,8 @@ rec { , pos ? # position used in error messages and for meta.position (if attrs.meta.description or null != null then builtins.unsafeGetAttrPos "description" attrs.meta + else if attrs.version or null != null + then builtins.unsafeGetAttrPos "version" attrs else builtins.unsafeGetAttrPos "name" attrs) , separateDebugInfo ? false , outputs ? [ "out" ] @@ -78,6 +82,13 @@ rec { , ... } @ attrs: + # Check that the name is consistent with pname and version: + assert lib.assertMsg + (lib.lists.all (name: builtins.hasAttr name attrs) ["name" "pname" "version"] + -> lib.strings.hasSuffix "${attrs.pname}-${attrs.version}" attrs.name) + ("mkDerivation: `name` (\"${attrs.name}\") must be consistent " + + "with `pname-version` \"${attrs.pname}-${attrs.version}\""); + let # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when # no package has `doCheck = true`. |