1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

Merge remote-tracking branch 'origin/master' into flakes

This commit is contained in:
Eelco Dolstra 2019-12-11 14:53:30 +01:00
commit ecb3a1afa2
119 changed files with 3905 additions and 2250 deletions

View file

@ -77,7 +77,7 @@ void EvalCache::addDerivation(
(fingerprint.hash, fingerprint.hashSize)
(attrPath)
(ValueType::Derivation)
(drv.drvPath + " " + drv.outPath + " " + drv.outputName).exec();
(std::string(drv.drvPath.to_string()) + " " + std::string(drv.outPath.to_string()) + " " + drv.outputName).exec();
}
std::optional<EvalCache::Derivation> EvalCache::getDerivation(
@ -104,7 +104,7 @@ std::optional<EvalCache::Derivation> EvalCache::getDerivation(
debug("evaluation cache hit for '%s'", attrPath);
return Derivation { ss[0], ss[1], ss[2] };
return Derivation { StorePath::fromBaseName(ss[0]), StorePath::fromBaseName(ss[1]), ss[2] };
}
EvalCache & EvalCache::singleton()

View file

@ -2,6 +2,7 @@
#include "sync.hh"
#include "flake.hh"
#include "path.hh"
namespace nix { struct SQLite; struct SQLiteStmt; }
@ -19,8 +20,8 @@ public:
struct Derivation
{
Path drvPath;
Path outPath;
StorePath drvPath;
StorePath outPath;
std::string outputName;
};

View file

@ -163,7 +163,7 @@ static SourceInfo fetchInput(EvalState & state, const FlakeRef & resolvedRef)
SourceInfo info(ref);
info.storePath = gitInfo.storePath;
info.revCount = gitInfo.revCount;
info.narHash = state.store->queryPathInfo(info.storePath)->narHash;
info.narHash = state.store->queryPathInfo(state.store->parseStorePath(info.storePath))->narHash;
info.lastModified = gitInfo.lastModified;
return info;
};
@ -212,7 +212,7 @@ static Flake getFlake(EvalState & state, const FlakeRef & originalRef,
refMap.push_back({originalRef, resolvedRef});
refMap.push_back({flakeRef, resolvedRef});
state.store->assertStorePath(sourceInfo.storePath);
state.store->parseStorePath(sourceInfo.storePath);
if (state.allowedPaths)
state.allowedPaths->insert(state.store->toRealPath(sourceInfo.storePath));
@ -334,7 +334,7 @@ static SourceInfo getNonFlake(EvalState & state, const FlakeRef & originalRef,
refMap.push_back({originalRef, resolvedRef});
refMap.push_back({flakeRef, resolvedRef});
state.store->assertStorePath(sourceInfo.storePath);
state.store->parseStorePath(sourceInfo.storePath);
if (state.allowedPaths)
state.allowedPaths->insert(sourceInfo.storePath);
@ -490,7 +490,7 @@ void updateLockFile(EvalState & state, const FlakeRef & flakeRef, bool recreateL
static void emitSourceInfoAttrs(EvalState & state, const SourceInfo & sourceInfo, Value & vAttrs)
{
auto & path = sourceInfo.storePath;
assert(state.store->isValidPath(path));
assert(state.store->isValidPath(state.store->parseStorePath(path)));
mkString(*state.allocAttr(vAttrs, state.sOutPath), path, {path});
if (sourceInfo.resolvedRef.rev) {
@ -542,7 +542,7 @@ static void prim_callFlake(EvalState & state, const Pos & pos, Value * * args, V
state.mkAttrs(v, 8);
assert(state.store->isValidPath(sourceInfo.storePath));
assert(state.store->isValidPath(state.store->parseStorePath(sourceInfo.storePath)));
mkString(*state.allocAttr(v, state.sOutPath),
sourceInfo.storePath, {sourceInfo.storePath});

View file

@ -161,7 +161,7 @@ FlakeRef::FlakeRef(const std::string & uri_, bool allowRelative)
}
while (true) {
if (pathExists(d.path + "/.git")) break;
subdir = baseNameOf(d.path) + (subdir.empty() ? "" : "/" + subdir);
subdir = std::string(baseNameOf(d.path)) + (subdir.empty() ? "" : "/" + subdir);
d.path = dirOf(d.path);
if (d.path == "/")
throw MissingFlake("path '%s' is not a flake (because it does not reference a Git repository)", uri);

View file

@ -26,7 +26,7 @@ nlohmann::json LockedInput::toJson() const
Path LockedInput::computeStorePath(Store & store) const
{
return store.makeFixedOutputPath(true, narHash, "source");
return store.printStorePath(store.makeFixedOutputPath(true, narHash, "source"));
}
LockedInputs::LockedInputs(const nlohmann::json & json)