aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-06 16:40:10 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-06 16:40:10 +0200
commit54712aaf8a4d9d6a42232fe9b360fc72f35ed02d (patch)
tree02f1ad7cb8628ed5877ed411a7ed67b3c0917da9 /src/nix
parent6ff9aa8df7ce8266147f74c65e2cc529a1e72ce0 (diff)
parent14227aeb327798a1446ddde59fc561c3d2e6b7a8 (diff)
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/develop.cc10
-rw-r--r--src/nix/flake.cc18
-rw-r--r--src/nix/repl.cc6
3 files changed, 14 insertions, 20 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 9a50fd47e..0bd862daa 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -50,7 +50,7 @@ BuildEnvironment readEnvironment(const Path & path)
R"re((?:\$?'(?:[^'\\]|\\[abeEfnrtv\\'"?])*'))re";
static std::string indexedArrayRegex =
- R"re((?:\(( *\[[0-9]+]="(?:[^"\\]|\\.)*")**\)))re";
+ R"re((?:\(( *\[[0-9]+\]="(?:[^"\\]|\\.)*")*\)))re";
static std::regex varRegex(
"^(" + varNameRegex + ")=(" + simpleStringRegex + "|" + quotedStringRegex + "|" + indexedArrayRegex + ")\n");
@@ -135,13 +135,7 @@ StorePath getDerivationEnvironment(ref<Store> store, const StorePath & drvPath)
drv.inputSrcs.insert(std::move(getEnvShPath));
Hash h = hashDerivationModulo(*store, drv, true);
auto shellOutPath = store->makeOutputPath("out", h, drvName);
- drv.outputs.insert_or_assign("out", DerivationOutput {
- .path = shellOutPath,
- .hash = FixedOutputHash {
- .method = FileIngestionMethod::Flat,
- .hash = Hash { },
- },
- });
+ drv.outputs.insert_or_assign("out", DerivationOutput { .path = shellOutPath });
drv.env["out"] = store->printStorePath(shellOutPath);
auto shellDrvPath2 = writeDerivation(store, drv, drvName);
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 847985ea3..027a9871e 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -234,7 +234,7 @@ struct CmdFlakeCheck : FlakeCommand
// FIXME: check meta attributes
return store->parseStorePath(drvInfo->queryDrvPath());
} catch (Error & e) {
- e.addPrefix(fmt("while checking the derivation '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
+ e.addTrace(pos, hintfmt("while checking the derivation '%s'", attrPath));
throw;
}
};
@@ -252,7 +252,7 @@ struct CmdFlakeCheck : FlakeCommand
}
#endif
} catch (Error & e) {
- e.addPrefix(fmt("while checking the app definition '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
+ e.addTrace(pos, hintfmt("while checking the app definition '%s'", attrPath));
throw;
}
};
@@ -268,7 +268,7 @@ struct CmdFlakeCheck : FlakeCommand
// FIXME: if we have a 'nixpkgs' input, use it to
// evaluate the overlay.
} catch (Error & e) {
- e.addPrefix(fmt("while checking the overlay '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
+ e.addTrace(pos, hintfmt("while checking the overlay '%s'", attrPath));
throw;
}
};
@@ -284,7 +284,7 @@ struct CmdFlakeCheck : FlakeCommand
try {
state->forceValue(*attr.value, *attr.pos);
} catch (Error & e) {
- e.addPrefix(fmt("while evaluating the option '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attr.name, *attr.pos));
+ e.addTrace(*attr.pos, hintfmt("while evaluating the option '%s'", attr.name));
throw;
}
} else
@@ -292,7 +292,7 @@ struct CmdFlakeCheck : FlakeCommand
// FIXME: if we have a 'nixpkgs' input, use it to
// check the module.
} catch (Error & e) {
- e.addPrefix(fmt("while checking the NixOS module '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
+ e.addTrace(pos, hintfmt("while checking the NixOS module '%s'", attrPath));
throw;
}
};
@@ -314,7 +314,7 @@ struct CmdFlakeCheck : FlakeCommand
}
} catch (Error & e) {
- e.addPrefix(fmt("while checking the Hydra jobset '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
+ e.addTrace(pos, hintfmt("while checking the Hydra jobset '%s'", attrPath));
throw;
}
};
@@ -329,7 +329,7 @@ struct CmdFlakeCheck : FlakeCommand
if (!state->isDerivation(*vToplevel))
throw Error("attribute 'config.system.build.toplevel' is not a derivation");
} catch (Error & e) {
- e.addPrefix(fmt("while checking the NixOS configuration '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
+ e.addTrace(pos, hintfmt("while checking the NixOS configuration '%s'", attrPath));
throw;
}
};
@@ -363,7 +363,7 @@ struct CmdFlakeCheck : FlakeCommand
throw Error("template '%s' has unsupported attribute '%s'", attrPath, name);
}
} catch (Error & e) {
- e.addPrefix(fmt("while checking the template '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
+ e.addTrace(pos, hintfmt("while checking the template '%s'", attrPath));
throw;
}
};
@@ -494,7 +494,7 @@ struct CmdFlakeCheck : FlakeCommand
warn("unknown flake output '%s'", name);
} catch (Error & e) {
- e.addPrefix(fmt("while checking flake output '" ANSI_BOLD "%s" ANSI_NORMAL "':\n", name));
+ e.addTrace(pos, hintfmt("while checking flake output '%s'", name));
throw;
}
});
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index c30ac2f79..8eb58f62a 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -211,12 +211,12 @@ void NixRepl::mainLoop(const std::vector<std::string> & files)
// input without clearing the input so far.
continue;
} else {
- printMsg(lvlError, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
+ printMsg(lvlError, e.msg());
}
} catch (Error & e) {
- printMsg(lvlError, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
+ printMsg(lvlError, e.msg());
} catch (Interrupted & e) {
- printMsg(lvlError, error + "%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
+ printMsg(lvlError, e.msg());
}
// We handled the current input fully, so we should clear it