1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

Make derivationFromPath work on diverted stores

This commit is contained in:
Eelco Dolstra 2016-06-02 18:43:36 +02:00
parent eda2aaae92
commit d64e0c1b64
5 changed files with 27 additions and 18 deletions

View file

@ -3,6 +3,7 @@
#include "globals.hh"
#include "util.hh"
#include "worker-protocol.hh"
#include "fs-accessor.hh"
namespace nix {
@ -164,6 +165,19 @@ Derivation readDerivation(const Path & drvPath)
}
Derivation Store::derivationFromPath(const Path & drvPath)
{
assertStorePath(drvPath);
ensurePath(drvPath);
auto accessor = getFSAccessor();
try {
return parseDerivation(accessor->readFile(drvPath));
} catch (FormatError & e) {
throw Error(format("error parsing derivation %1%: %2%") % drvPath % e.msg());
}
}
static void printString(string & res, const string & s)
{
res += '"';