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:
parent
eda2aaae92
commit
d64e0c1b64
5 changed files with 27 additions and 18 deletions
|
@ -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 += '"';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue