summaryrefslogtreecommitdiffstats
path: root/pkgs/stdenv/generic
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-01-28 09:25:47 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2019-01-28 09:25:47 -0500
commit7e589e55948c1c141d2746b98a3ad6ae1bff8899 (patch)
tree5591ad1f9a2e4c8905496f4f942a612c3fcc161a /pkgs/stdenv/generic
parent2a051165d53585630a602e831496f7157c519885 (diff)
make-derivation: fix position in trace
For a long time now, tracing has been broken in Nixpkgs. So when you have an eval error you would get something like this: error: while evaluating the attribute 'buildInputs' of the derivation 'hello-2.10' at /home/mbauer/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:185:11: while evaluating 'chooseDevOutputs' at /home/mbauer/nixpkgs/lib/attrsets.nix:474:22, called from undefined position: while evaluating 'optionals' at /home/mbauer/nixpkgs/lib/lists.nix:257:5, called from /home/mbauer/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:132:17: This is coming from how Nix handles string context and how make-derivation messes with the "name" attribute. This commit should restore the old behavior so you get a nice line number like: error: while evaluating the attribute 'buildInputs' of the derivation 'hello-2.10' at /home/mbauer/nixpkgs/pkgs/applications/misc/hello/default.nix:4:3: while evaluating 'chooseDevOutputs' at /home/mbauer/nixpkgs/lib/attrsets.nix:474:22, called from undefined position: while evaluating 'optionals' at /home/mbauer/nixpkgs/lib/lists.nix:257:5, called from /home/mbauer/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:132:17: NOTE: This will still be broken for cross compilation due to the prefixes we are adding to name.
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix22
1 files changed, 10 insertions, 12 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index c646b6d715bd..90dbb102fae9 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -81,8 +81,6 @@ rec {
, ... } @ attrs:
let
- computedName = if name != "" then name else "${attrs.pname}-${attrs.version}";
-
# TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when
# no package has `doCheck = true`.
doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform;
@@ -179,15 +177,15 @@ rec {
"checkInputs" "installCheckInputs"
"__impureHostDeps" "__propagatedImpureHostDeps"
"sandboxProfile" "propagatedSandboxProfile"])
- // {
- name = computedName + lib.optionalString
- # 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.
- (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)
- ("-" + stdenv.hostPlatform.config);
-
+ // (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}";
+ } // (lib.optionalAttrs (name == "")) {
+ name = "${attrs.pname}-${attrs.version}";
+ } // {
builder = attrs.realBuilder or stdenv.shell;
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
inherit stdenv;
@@ -276,7 +274,7 @@ rec {
meta = {
# `name` above includes cross-compilation cruft (and is under assert),
# lets have a clean always accessible version here.
- name = computedName;
+ name = if name != "" then name else "${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`;