From 7e589e55948c1c141d2746b98a3ad6ae1bff8899 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 28 Jan 2019 09:25:47 -0500 Subject: [PATCH 1/5] 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. --- pkgs/stdenv/generic/make-derivation.nix | 22 ++++++++++------------ 1 file 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`; From e20b65156cee92d30b43f8e339bd686bd83538cb Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 28 Jan 2019 09:59:10 -0500 Subject: [PATCH 2/5] coq-modules: add default to fix eval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don’t want these to not even evaluate, otherwise we won’t know why they’re broken. For now, I’ve left these as the latest version for a default. In the future, maybe we should be smarter about choosing these. --- 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 96954eb43ace..34daebcdf528 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}"; + param = params."${coq.coq-version}" or params."8.8"; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/Velisarios/default.nix b/pkgs/development/coq-modules/Velisarios/default.nix index cd7ddfefb84a..aa5ebb32b3ce 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}"; + param = params."${coq.coq-version}" or params."8.8"; 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 59f2295e2153..a8fd91d9d348 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}"; + param = params."${coq.coq-version}" or params."8.8"; 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 57f31e1847c1..784e360a0dab 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}"; + param = params."${coq.coq-version}" or params."8.8"; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/coqprime/default.nix b/pkgs/development/coq-modules/coqprime/default.nix index 191812b3f2eb..265b97deca2c 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}" + param = params."${coq.coq-version}" or params."8.9" ; in stdenv.mkDerivation rec { diff --git a/pkgs/development/coq-modules/dpdgraph/default.nix b/pkgs/development/coq-modules/dpdgraph/default.nix index e403f7d4fb5c..6a06c1b19875 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}"; +param = params."${coq.coq-version}" or params."8.8"; in stdenv.mkDerivation { diff --git a/pkgs/development/coq-modules/equations/default.nix b/pkgs/development/coq-modules/equations/default.nix index 3f049eed34be..6072c000059f 100644 --- a/pkgs/development/coq-modules/equations/default.nix +++ b/pkgs/development/coq-modules/equations/default.nix @@ -20,7 +20,7 @@ let sha256 = "0dd7zd5j2sv5cw3mfwg33ss2vcj634q3qykakc41sv7f3rfgqfnn"; }; }; - param = params."${coq.coq-version}"; + param = params."${coq.coq-version}" or params."8.8"; in stdenv.mkDerivation rec { From 9fd1c170cc10fbd2bbc4eb37c8b4f35e383c3731 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 28 Jan 2019 10:00:10 -0500 Subject: [PATCH 3/5] make-derivation: try to fix stdenv.cc == null conditional sometimes this gets an infinite recursion error --- pkgs/stdenv/generic/make-derivation.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 90dbb102fae9..f9792aaf01f4 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -94,7 +94,7 @@ rec { ++ depsHostHost ++ depsHostHostPropagated ++ buildInputs ++ propagatedBuildInputs ++ depsTargetTarget ++ depsTargetTargetPropagated) == 0; - dontAddHostSuffix = attrs ? outputHash && !noNonNativeDeps || stdenv.cc == null; + dontAddHostSuffix = attrs ? outputHash && !noNonNativeDeps || (stdenv.noCC or false); supportedHardeningFlags = [ "fortify" "stackprotector" "pie" "pic" "strictoverflow" "format" "relro" "bindnow" ]; defaultHardeningFlags = if stdenv.hostPlatform.isMusl then supportedHardeningFlags diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5477c91251b2..eae1a744f1d5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33,7 +33,7 @@ in # just the plain stdenv. stdenv_32bit = lowPrio (if stdenv.hostPlatform.is32bit then stdenv else multiStdenv); - stdenvNoCC = stdenv.override { cc = null; }; + stdenvNoCC = stdenv.override { cc = null; extraAttrs.noCC = true; }; stdenvNoLibs = let bintools = stdenv.cc.bintools.override { From febda2b127ce34b6b408fe65a7c6b86923e97114 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 28 Jan 2019 10:42:04 -0500 Subject: [PATCH 4/5] Revert "mingw: use current package set for headers" This reverts commit 03072036937c250976f0522b070eefe96e8ab0f1. --- pkgs/os-specific/windows/mingw-w64/default.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index 61a7fb149427..a7d4f09b90e9 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -21,6 +21,6 @@ in stdenv.mkDerivation { patches = [ ./osvi.patch ]; meta = { - platforms = stdenv.lib.platforms.all; + platforms = stdenv.lib.platforms.windows; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eae1a744f1d5..735f69bad491 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6762,7 +6762,7 @@ in # built with, and use, that cross-compiled libc. gccCrossStageStatic = assert stdenv.targetPlatform != stdenv.hostPlatform; let libcCross1 = - if stdenv.targetPlatform.libc == "msvcrt" then windows.mingw_w64_headers + if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode else null; binutils1 = wrapBintoolsWith { From e2fe4c2d496764b4dbfa5af78d58741efe3ddfa4 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 28 Jan 2019 11:38:30 -0500 Subject: [PATCH 5/5] make-derivation: fix ordering of conditionals cross should have higher precedence --- pkgs/stdenv/generic/make-derivation.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index f9792aaf01f4..1cb5639debe6 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -177,14 +177,14 @@ rec { "checkInputs" "installCheckInputs" "__impureHostDeps" "__propagatedImpureHostDeps" "sandboxProfile" "propagatedSandboxProfile"]) - // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)) { + // (lib.optionalAttrs (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}"; - } // (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)];