Don't show <nix/derivation.nix> in stack traces

Messages like

  while evaluating the attribute `outPath' at `/nix/store/212ngf4ph63mp6p1np2bapkfikpakfv7-nix-1.6/share/nix/corepkgs/derivation.nix:18:9':

are redundant, because Nix already shows that it's evaluating a derivation:

  while instantiating the derivation named `firefox-24.0' at `/home/eelco/Dev/nixpkgs/pkgs/applications/networking/browsers/firefox/default.nix:131:5':
  while evaluating the derivation attribute `nativeBuildInputs' at `/home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/default.nix:76:17':
This commit is contained in:
Eelco Dolstra 2013-10-17 11:47:38 +02:00
parent bb659bad81
commit f440558acc
3 changed files with 5 additions and 2 deletions

View file

@ -639,7 +639,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
state.forceValue(*vAttrs);
} catch (Error & e) {
if (pos)
if (pos && pos->file != state.sDerivationNix)
addErrorPrefix(e, "while evaluating the attribute `%1%' at %2%:\n",
showAttrPath(attrPath), *pos);
throw;

View file

@ -95,6 +95,7 @@ public:
const Symbol sWith, sOutPath, sDrvPath, sType, sMeta, sName,
sSystem, sOverrides, sOutputs, sOutputName, sIgnoreNulls;
Symbol sDerivationNix;
/* If set, force copying files to the Nix store even if they
already exist there. */

View file

@ -1262,7 +1262,9 @@ void EvalState::createBaseEnv()
/* Add a wrapper around the derivation primop that computes the
`drvPath' and `outPath' attributes lazily. */
evalFile(findFile("nix/derivation.nix"), v);
string path = findFile("nix/derivation.nix");
sDerivationNix = symbols.create(path);
evalFile(path, v);
addConstant("derivation", v);
/* Now that we've added all primops, sort the `builtins' attribute