From 0d17ecce2c2e7c595583c8c24f3e3e3f72b12fc7 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Fri, 1 Feb 2019 15:59:12 +0000 Subject: [PATCH 1/3] mkDerivation: cleaner handling of the `name` argument --- pkgs/stdenv/generic/make-derivation.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 9ba06995940c..8f0f12ea1a20 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -12,7 +12,7 @@ rec { # * https://nixos.org/nix/manual/#ssec-derivation # Explanation about derivations in general mkDerivation = - { name ? "" + { # These types of dependencies are all exhaustively documented in # the "Specifying Dependencies" section of the "Standard @@ -21,7 +21,7 @@ rec { # TODO(@Ericson2314): Stop using legacy dep attribute names # host offset -> target offset - , depsBuildBuild ? [] # -1 -> -1 + depsBuildBuild ? [] # -1 -> -1 , depsBuildBuildPropagated ? [] # -1 -> -1 , nativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name , propagatedNativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name @@ -177,14 +177,14 @@ rec { "checkInputs" "installCheckInputs" "__impureHostDeps" "__propagatedImpureHostDeps" "sandboxProfile" "propagatedSandboxProfile"]) - // (lib.optionalAttrs (name == "")) { + // (lib.optionalAttrs (!(attrs ? name))) { name = "${attrs.pname}-${attrs.version}"; } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)) { # Fixed-output derivations like source tarballs shouldn't get a host # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the # hash can't be the same. See #32986. - name = "${if name != "" then name else "${attrs.pname}-${attrs.version}"}-${stdenv.hostPlatform.config}"; + name = "${attrs.name or "${attrs.pname}-${attrs.version}"}-${stdenv.hostPlatform.config}"; } // { builder = attrs.realBuilder or stdenv.shell; args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; @@ -274,7 +274,7 @@ rec { meta = { # `name` above includes cross-compilation cruft (and is under assert), # lets have a clean always accessible version here. - name = if name != "" then name else "${attrs.pname}-${attrs.version}"; + name = attrs.name or "${attrs.pname}-${attrs.version}"; # If the packager hasn't specified `outputsToInstall`, choose a default, # which is the name of `p.bin or p.out or p`; From 59949aa55ce23ecdb8661b57df57b8fa2d84d0b7 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Fri, 1 Feb 2019 15:59:45 +0000 Subject: [PATCH 2/3] Revert "coq-modules: add default to fix eval" This reverts commit e20b65156cee92d30b43f8e339bd686bd83538cb. --- pkgs/development/coq-modules/QuickChick/default.nix | 2 +- pkgs/development/coq-modules/Velisarios/default.nix | 2 +- pkgs/development/coq-modules/category-theory/default.nix | 2 +- pkgs/development/coq-modules/coq-haskell/default.nix | 2 +- pkgs/development/coq-modules/coqprime/default.nix | 2 +- pkgs/development/coq-modules/dpdgraph/default.nix | 2 +- pkgs/development/coq-modules/equations/default.nix | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/development/coq-modules/QuickChick/default.nix b/pkgs/development/coq-modules/QuickChick/default.nix index 34daebcdf528..96954eb43ace 100644 --- a/pkgs/development/coq-modules/QuickChick/default.nix +++ b/pkgs/development/coq-modules/QuickChick/default.nix @@ -28,7 +28,7 @@ let params = propagatedBuildInputs = [ coq-ext-lib simple-io ]; }; }; - param = params."${coq.coq-version}" or params."8.8"; + param = params."${coq.coq-version}"; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/Velisarios/default.nix b/pkgs/development/coq-modules/Velisarios/default.nix index aa5ebb32b3ce..cd7ddfefb84a 100644 --- a/pkgs/development/coq-modules/Velisarios/default.nix +++ b/pkgs/development/coq-modules/Velisarios/default.nix @@ -20,7 +20,7 @@ let params = sha256 = "0l9885nxy0n955fj1gnijlxl55lyxiv9yjfmz8hmfrn9hl8vv1m2"; }; }; - param = params."${coq.coq-version}" or params."8.8"; + param = params."${coq.coq-version}"; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/category-theory/default.nix b/pkgs/development/coq-modules/category-theory/default.nix index a8fd91d9d348..59f2295e2153 100644 --- a/pkgs/development/coq-modules/category-theory/default.nix +++ b/pkgs/development/coq-modules/category-theory/default.nix @@ -18,7 +18,7 @@ let "8.7" = v20180709; "8.8" = v20181016; }; - param = params."${coq.coq-version}" or params."8.8"; + param = params."${coq.coq-version}"; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/coq-haskell/default.nix b/pkgs/development/coq-modules/coq-haskell/default.nix index 784e360a0dab..57f31e1847c1 100644 --- a/pkgs/development/coq-modules/coq-haskell/default.nix +++ b/pkgs/development/coq-modules/coq-haskell/default.nix @@ -26,7 +26,7 @@ let params = sha256 = "09dq1vvshhlhgjccrhqgbhnq2hrys15xryfszqq11rzpgvl2zgdv"; }; }; - param = params."${coq.coq-version}" or params."8.8"; + param = params."${coq.coq-version}"; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/coqprime/default.nix b/pkgs/development/coq-modules/coqprime/default.nix index 265b97deca2c..191812b3f2eb 100644 --- a/pkgs/development/coq-modules/coqprime/default.nix +++ b/pkgs/development/coq-modules/coqprime/default.nix @@ -14,7 +14,7 @@ let params = "8.8" = v_8_8; "8.9" = v_8_8; }; - param = params."${coq.coq-version}" or params."8.9" + param = params."${coq.coq-version}" ; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/dpdgraph/default.nix b/pkgs/development/coq-modules/dpdgraph/default.nix index 6a06c1b19875..e403f7d4fb5c 100644 --- a/pkgs/development/coq-modules/dpdgraph/default.nix +++ b/pkgs/development/coq-modules/dpdgraph/default.nix @@ -22,7 +22,7 @@ let params = { sha256 = "0qvar8gfbrcs9fmvkph5asqz4l5fi63caykx3bsn8zf0xllkwv0n"; }; }; -param = params."${coq.coq-version}" or params."8.8"; +param = params."${coq.coq-version}"; in stdenv.mkDerivation { diff --git a/pkgs/development/coq-modules/equations/default.nix b/pkgs/development/coq-modules/equations/default.nix index 1bc66fcf272a..86e5687321b4 100644 --- a/pkgs/development/coq-modules/equations/default.nix +++ b/pkgs/development/coq-modules/equations/default.nix @@ -26,7 +26,7 @@ let sha256 = "1sj7vyarmvp1w5kvbhgpgap1yd0yrj4n1jrla0wv70k0jrq5hhpz"; }; }; - param = params."${coq.coq-version}" or params."8.8"; + param = params."${coq.coq-version}"; in stdenv.mkDerivation rec { From c6f8f8d98de092f6e6540822849dee994f41dde5 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 4 Feb 2019 09:15:03 -0500 Subject: [PATCH 3/3] make-derivation: only modify name when name is given MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This preserves Nix’s native error handling of missing name: error: derivation name missing --- pkgs/stdenv/generic/make-derivation.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 8f0f12ea1a20..fdb3a2ce35a2 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -177,9 +177,9 @@ rec { "checkInputs" "installCheckInputs" "__impureHostDeps" "__propagatedImpureHostDeps" "sandboxProfile" "propagatedSandboxProfile"]) - // (lib.optionalAttrs (!(attrs ? name))) { + // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { name = "${attrs.pname}-${attrs.version}"; - } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)) { + } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) { # Fixed-output derivations like source tarballs shouldn't get a host # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the