mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
libfetchers: Rename immutable -> locked
This is more consistent with flake terminology.
This commit is contained in:
parent
3317866060
commit
8518cebfce
13 changed files with 52 additions and 50 deletions
|
@ -501,7 +501,7 @@ LockedFlake lockFlake(
|
||||||
this input. */
|
this input. */
|
||||||
debug("creating new input '%s'", inputPathS);
|
debug("creating new input '%s'", inputPathS);
|
||||||
|
|
||||||
if (!lockFlags.allowMutable && !input.ref->input.isImmutable())
|
if (!lockFlags.allowMutable && !input.ref->input.isLocked())
|
||||||
throw Error("cannot update flake input '%s' in pure mode", inputPathS);
|
throw Error("cannot update flake input '%s' in pure mode", inputPathS);
|
||||||
|
|
||||||
if (input.isFlake) {
|
if (input.isFlake) {
|
||||||
|
@ -650,7 +650,7 @@ LockedFlake lockFlake(
|
||||||
now. Corner case: we could have reverted from a
|
now. Corner case: we could have reverted from a
|
||||||
dirty to a clean tree! */
|
dirty to a clean tree! */
|
||||||
if (flake.lockedRef.input == prevLockedRef.input
|
if (flake.lockedRef.input == prevLockedRef.input
|
||||||
&& !flake.lockedRef.input.isImmutable())
|
&& !flake.lockedRef.input.isLocked())
|
||||||
throw Error("'%s' did not change after I updated its 'flake.lock' file; is 'flake.lock' under version control?", flake.originalRef);
|
throw Error("'%s' did not change after I updated its 'flake.lock' file; is 'flake.lock' under version control?", flake.originalRef);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -709,8 +709,8 @@ static void prim_getFlake(EvalState & state, const Pos & pos, Value * * args, Va
|
||||||
|
|
||||||
string flakeRefS(state.forceStringNoCtx(*args[0], pos));
|
string flakeRefS(state.forceStringNoCtx(*args[0], pos));
|
||||||
auto flakeRef = parseFlakeRef(flakeRefS, {}, true);
|
auto flakeRef = parseFlakeRef(flakeRefS, {}, true);
|
||||||
if (evalSettings.pureEval && !flakeRef.input.isImmutable())
|
if (evalSettings.pureEval && !flakeRef.input.isLocked())
|
||||||
throw Error("cannot call 'getFlake' on mutable flake reference '%s', at %s (use --impure to override)", flakeRefS, pos);
|
throw Error("cannot call 'getFlake' on unlocked flake reference '%s', at %s (use --impure to override)", flakeRefS, pos);
|
||||||
|
|
||||||
callFlake(state,
|
callFlake(state,
|
||||||
lockFlake(state, flakeRef,
|
lockFlake(state, flakeRef,
|
||||||
|
|
|
@ -35,7 +35,7 @@ LockedNode::LockedNode(const nlohmann::json & json)
|
||||||
, originalRef(getFlakeRef(json, "original", nullptr))
|
, originalRef(getFlakeRef(json, "original", nullptr))
|
||||||
, isFlake(json.find("flake") != json.end() ? (bool) json["flake"] : true)
|
, isFlake(json.find("flake") != json.end() ? (bool) json["flake"] : true)
|
||||||
{
|
{
|
||||||
if (!lockedRef.input.isImmutable())
|
if (!lockedRef.input.isLocked())
|
||||||
throw Error("lockfile contains mutable lock '%s'",
|
throw Error("lockfile contains mutable lock '%s'",
|
||||||
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ bool LockFile::isImmutable() const
|
||||||
for (auto & i : nodes) {
|
for (auto & i : nodes) {
|
||||||
if (i == root) continue;
|
if (i == root) continue;
|
||||||
auto lockedNode = std::dynamic_pointer_cast<const LockedNode>(i);
|
auto lockedNode = std::dynamic_pointer_cast<const LockedNode>(i);
|
||||||
if (lockedNode && !lockedNode->lockedRef.input.isImmutable()) return false;
|
if (lockedNode && !lockedNode->lockedRef.input.isLocked()) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,7 +19,7 @@ void emitTreeAttrs(
|
||||||
bool emptyRevFallback,
|
bool emptyRevFallback,
|
||||||
bool forceDirty)
|
bool forceDirty)
|
||||||
{
|
{
|
||||||
assert(input.isImmutable());
|
assert(input.isLocked());
|
||||||
|
|
||||||
auto attrs = state.buildBindings(8);
|
auto attrs = state.buildBindings(8);
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ static void fetchTree(
|
||||||
if (!evalSettings.pureEval && !input.isDirect())
|
if (!evalSettings.pureEval && !input.isDirect())
|
||||||
input = lookupInRegistries(state.store, input).first;
|
input = lookupInRegistries(state.store, input).first;
|
||||||
|
|
||||||
if (evalSettings.pureEval && !input.isImmutable())
|
if (evalSettings.pureEval && !input.isLocked())
|
||||||
throw Error("in pure evaluation mode, 'fetchTree' requires an immutable input, at %s", pos);
|
throw Error("in pure evaluation mode, 'fetchTree' requires a locked input, at %s", pos);
|
||||||
|
|
||||||
auto [tree, input2] = input.fetch(state.store);
|
auto [tree, input2] = input.fetch(state.store);
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@ struct CacheImpl : Cache
|
||||||
const Attrs & inAttrs,
|
const Attrs & inAttrs,
|
||||||
const Attrs & infoAttrs,
|
const Attrs & infoAttrs,
|
||||||
const StorePath & storePath,
|
const StorePath & storePath,
|
||||||
bool immutable) override
|
bool locked) override
|
||||||
{
|
{
|
||||||
_state.lock()->add.use()
|
_state.lock()->add.use()
|
||||||
(attrsToJSON(inAttrs).dump())
|
(attrsToJSON(inAttrs).dump())
|
||||||
(attrsToJSON(infoAttrs).dump())
|
(attrsToJSON(infoAttrs).dump())
|
||||||
(store->printStorePath(storePath))
|
(store->printStorePath(storePath))
|
||||||
(immutable)
|
(locked)
|
||||||
(time(0)).exec();
|
(time(0)).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ struct CacheImpl : Cache
|
||||||
|
|
||||||
auto infoJSON = stmt.getStr(0);
|
auto infoJSON = stmt.getStr(0);
|
||||||
auto storePath = store->parseStorePath(stmt.getStr(1));
|
auto storePath = store->parseStorePath(stmt.getStr(1));
|
||||||
auto immutable = stmt.getInt(2) != 0;
|
auto locked = stmt.getInt(2) != 0;
|
||||||
auto timestamp = stmt.getInt(3);
|
auto timestamp = stmt.getInt(3);
|
||||||
|
|
||||||
store->addTempRoot(storePath);
|
store->addTempRoot(storePath);
|
||||||
|
@ -105,7 +105,7 @@ struct CacheImpl : Cache
|
||||||
inAttrsJSON, infoJSON, store->printStorePath(storePath));
|
inAttrsJSON, infoJSON, store->printStorePath(storePath));
|
||||||
|
|
||||||
return Result {
|
return Result {
|
||||||
.expired = !immutable && (settings.tarballTtl.get() == 0 || timestamp + settings.tarballTtl < time(0)),
|
.expired = !locked && (settings.tarballTtl.get() == 0 || timestamp + settings.tarballTtl < time(0)),
|
||||||
.infoAttrs = jsonToAttrs(nlohmann::json::parse(infoJSON)),
|
.infoAttrs = jsonToAttrs(nlohmann::json::parse(infoJSON)),
|
||||||
.storePath = std::move(storePath)
|
.storePath = std::move(storePath)
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct Cache
|
||||||
const Attrs & inAttrs,
|
const Attrs & inAttrs,
|
||||||
const Attrs & infoAttrs,
|
const Attrs & infoAttrs,
|
||||||
const StorePath & storePath,
|
const StorePath & storePath,
|
||||||
bool immutable) = 0;
|
bool locked) = 0;
|
||||||
|
|
||||||
virtual std::optional<std::pair<Attrs, StorePath>> lookup(
|
virtual std::optional<std::pair<Attrs, StorePath>> lookup(
|
||||||
ref<Store> store,
|
ref<Store> store,
|
||||||
|
|
|
@ -24,11 +24,11 @@ static void fixupInput(Input & input)
|
||||||
input.getType();
|
input.getType();
|
||||||
input.getRef();
|
input.getRef();
|
||||||
if (input.getRev())
|
if (input.getRev())
|
||||||
input.immutable = true;
|
input.locked = true;
|
||||||
input.getRevCount();
|
input.getRevCount();
|
||||||
input.getLastModified();
|
input.getLastModified();
|
||||||
if (input.getNarHash())
|
if (input.getNarHash())
|
||||||
input.immutable = true;
|
input.locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Input Input::fromURL(const ParsedURL & url)
|
Input Input::fromURL(const ParsedURL & url)
|
||||||
|
@ -165,7 +165,7 @@ std::pair<Tree, Input> Input::fetch(ref<Store> store) const
|
||||||
input.to_string(), *prevRevCount);
|
input.to_string(), *prevRevCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
input.immutable = true;
|
input.locked = true;
|
||||||
|
|
||||||
assert(input.hasAllInfo());
|
assert(input.hasAllInfo());
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ StorePath Input::computeStorePath(Store & store) const
|
||||||
{
|
{
|
||||||
auto narHash = getNarHash();
|
auto narHash = getNarHash();
|
||||||
if (!narHash)
|
if (!narHash)
|
||||||
throw Error("cannot compute store path for mutable input '%s'", to_string());
|
throw Error("cannot compute store path for unlocked input '%s'", to_string());
|
||||||
return store.makeFixedOutputPath(FileIngestionMethod::Recursive, *narHash, getName());
|
return store.makeFixedOutputPath(FileIngestionMethod::Recursive, *narHash, getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct Input
|
||||||
|
|
||||||
std::shared_ptr<InputScheme> scheme; // note: can be null
|
std::shared_ptr<InputScheme> scheme; // note: can be null
|
||||||
Attrs attrs;
|
Attrs attrs;
|
||||||
bool immutable = false;
|
bool locked = false;
|
||||||
bool direct = true;
|
bool direct = true;
|
||||||
|
|
||||||
/* path of the parent of this input, used for relative path resolution */
|
/* path of the parent of this input, used for relative path resolution */
|
||||||
|
@ -59,9 +59,9 @@ public:
|
||||||
one that goes through a registry. */
|
one that goes through a registry. */
|
||||||
bool isDirect() const { return direct; }
|
bool isDirect() const { return direct; }
|
||||||
|
|
||||||
/* Check whether this is an "immutable" input, that is,
|
/* Check whether this is a "locked" input, that is,
|
||||||
one that contains a commit hash or content hash. */
|
one that contains a commit hash or content hash. */
|
||||||
bool isImmutable() const { return immutable; }
|
bool isLocked() const { return locked; }
|
||||||
|
|
||||||
bool hasAllInfo() const;
|
bool hasAllInfo() const;
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ public:
|
||||||
|
|
||||||
bool contains(const Input & other) const;
|
bool contains(const Input & other) const;
|
||||||
|
|
||||||
|
/* Fetch the input into the Nix store, returning the location in
|
||||||
|
the Nix store and the locked input. */
|
||||||
std::pair<Tree, Input> fetch(ref<Store> store) const;
|
std::pair<Tree, Input> fetch(ref<Store> store) const;
|
||||||
|
|
||||||
Input applyOverrides(
|
Input applyOverrides(
|
||||||
|
@ -146,14 +148,14 @@ DownloadFileResult downloadFile(
|
||||||
ref<Store> store,
|
ref<Store> store,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::string & name,
|
const std::string & name,
|
||||||
bool immutable,
|
bool locked,
|
||||||
const Headers & headers = {});
|
const Headers & headers = {});
|
||||||
|
|
||||||
std::pair<Tree, time_t> downloadTarball(
|
std::pair<Tree, time_t> downloadTarball(
|
||||||
ref<Store> store,
|
ref<Store> store,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::string & name,
|
const std::string & name,
|
||||||
bool immutable,
|
bool locked,
|
||||||
const Headers & headers = {});
|
const Headers & headers = {});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ struct GitInputScheme : InputScheme
|
||||||
if (submodules) cacheType += "-submodules";
|
if (submodules) cacheType += "-submodules";
|
||||||
if (allRefs) cacheType += "-all-refs";
|
if (allRefs) cacheType += "-all-refs";
|
||||||
|
|
||||||
auto getImmutableAttrs = [&]()
|
auto getLockedAttrs = [&]()
|
||||||
{
|
{
|
||||||
return Attrs({
|
return Attrs({
|
||||||
{"type", cacheType},
|
{"type", cacheType},
|
||||||
|
@ -208,7 +208,7 @@ struct GitInputScheme : InputScheme
|
||||||
};
|
};
|
||||||
|
|
||||||
if (input.getRev()) {
|
if (input.getRev()) {
|
||||||
if (auto res = getCache()->lookup(store, getImmutableAttrs()))
|
if (auto res = getCache()->lookup(store, getLockedAttrs()))
|
||||||
return makeResult(res->first, std::move(res->second));
|
return makeResult(res->first, std::move(res->second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ struct GitInputScheme : InputScheme
|
||||||
|
|
||||||
if (!input.getRef()) input.attrs.insert_or_assign("ref", isLocal ? readHead(actualUrl) : "master");
|
if (!input.getRef()) input.attrs.insert_or_assign("ref", isLocal ? readHead(actualUrl) : "master");
|
||||||
|
|
||||||
Attrs mutableAttrs({
|
Attrs unlockedAttrs({
|
||||||
{"type", cacheType},
|
{"type", cacheType},
|
||||||
{"name", name},
|
{"name", name},
|
||||||
{"url", actualUrl},
|
{"url", actualUrl},
|
||||||
|
@ -307,7 +307,7 @@ struct GitInputScheme : InputScheme
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (auto res = getCache()->lookup(store, mutableAttrs)) {
|
if (auto res = getCache()->lookup(store, unlockedAttrs)) {
|
||||||
auto rev2 = Hash::parseAny(getStrAttr(res->first, "rev"), htSHA1);
|
auto rev2 = Hash::parseAny(getStrAttr(res->first, "rev"), htSHA1);
|
||||||
if (!input.getRev() || input.getRev() == rev2) {
|
if (!input.getRev() || input.getRev() == rev2) {
|
||||||
input.attrs.insert_or_assign("rev", rev2.gitRev());
|
input.attrs.insert_or_assign("rev", rev2.gitRev());
|
||||||
|
@ -404,7 +404,7 @@ struct GitInputScheme : InputScheme
|
||||||
|
|
||||||
/* Now that we know the ref, check again whether we have it in
|
/* Now that we know the ref, check again whether we have it in
|
||||||
the store. */
|
the store. */
|
||||||
if (auto res = getCache()->lookup(store, getImmutableAttrs()))
|
if (auto res = getCache()->lookup(store, getLockedAttrs()))
|
||||||
return makeResult(res->first, std::move(res->second));
|
return makeResult(res->first, std::move(res->second));
|
||||||
|
|
||||||
Path tmpDir = createTempDir();
|
Path tmpDir = createTempDir();
|
||||||
|
@ -476,14 +476,14 @@ struct GitInputScheme : InputScheme
|
||||||
if (!_input.getRev())
|
if (!_input.getRev())
|
||||||
getCache()->add(
|
getCache()->add(
|
||||||
store,
|
store,
|
||||||
mutableAttrs,
|
unlockedAttrs,
|
||||||
infoAttrs,
|
infoAttrs,
|
||||||
storePath,
|
storePath,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
getCache()->add(
|
getCache()->add(
|
||||||
store,
|
store,
|
||||||
getImmutableAttrs(),
|
getLockedAttrs(),
|
||||||
infoAttrs,
|
infoAttrs,
|
||||||
storePath,
|
storePath,
|
||||||
true);
|
true);
|
||||||
|
|
|
@ -193,12 +193,12 @@ struct GitArchiveInputScheme : InputScheme
|
||||||
input.attrs.erase("ref");
|
input.attrs.erase("ref");
|
||||||
input.attrs.insert_or_assign("rev", rev->gitRev());
|
input.attrs.insert_or_assign("rev", rev->gitRev());
|
||||||
|
|
||||||
Attrs immutableAttrs({
|
Attrs lockedAttrs({
|
||||||
{"type", "git-tarball"},
|
{"type", "git-tarball"},
|
||||||
{"rev", rev->gitRev()},
|
{"rev", rev->gitRev()},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (auto res = getCache()->lookup(store, immutableAttrs)) {
|
if (auto res = getCache()->lookup(store, lockedAttrs)) {
|
||||||
input.attrs.insert_or_assign("lastModified", getIntAttr(res->first, "lastModified"));
|
input.attrs.insert_or_assign("lastModified", getIntAttr(res->first, "lastModified"));
|
||||||
return {std::move(res->second), input};
|
return {std::move(res->second), input};
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ struct GitArchiveInputScheme : InputScheme
|
||||||
|
|
||||||
getCache()->add(
|
getCache()->add(
|
||||||
store,
|
store,
|
||||||
immutableAttrs,
|
lockedAttrs,
|
||||||
{
|
{
|
||||||
{"rev", rev->gitRev()},
|
{"rev", rev->gitRev()},
|
||||||
{"lastModified", uint64_t(lastModified)}
|
{"lastModified", uint64_t(lastModified)}
|
||||||
|
|
|
@ -199,7 +199,7 @@ struct MercurialInputScheme : InputScheme
|
||||||
|
|
||||||
if (!input.getRef()) input.attrs.insert_or_assign("ref", "default");
|
if (!input.getRef()) input.attrs.insert_or_assign("ref", "default");
|
||||||
|
|
||||||
auto getImmutableAttrs = [&]()
|
auto getLockedAttrs = [&]()
|
||||||
{
|
{
|
||||||
return Attrs({
|
return Attrs({
|
||||||
{"type", "hg"},
|
{"type", "hg"},
|
||||||
|
@ -218,20 +218,20 @@ struct MercurialInputScheme : InputScheme
|
||||||
};
|
};
|
||||||
|
|
||||||
if (input.getRev()) {
|
if (input.getRev()) {
|
||||||
if (auto res = getCache()->lookup(store, getImmutableAttrs()))
|
if (auto res = getCache()->lookup(store, getLockedAttrs()))
|
||||||
return makeResult(res->first, std::move(res->second));
|
return makeResult(res->first, std::move(res->second));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto revOrRef = input.getRev() ? input.getRev()->gitRev() : *input.getRef();
|
auto revOrRef = input.getRev() ? input.getRev()->gitRev() : *input.getRef();
|
||||||
|
|
||||||
Attrs mutableAttrs({
|
Attrs unlockedAttrs({
|
||||||
{"type", "hg"},
|
{"type", "hg"},
|
||||||
{"name", name},
|
{"name", name},
|
||||||
{"url", actualUrl},
|
{"url", actualUrl},
|
||||||
{"ref", *input.getRef()},
|
{"ref", *input.getRef()},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (auto res = getCache()->lookup(store, mutableAttrs)) {
|
if (auto res = getCache()->lookup(store, unlockedAttrs)) {
|
||||||
auto rev2 = Hash::parseAny(getStrAttr(res->first, "rev"), htSHA1);
|
auto rev2 = Hash::parseAny(getStrAttr(res->first, "rev"), htSHA1);
|
||||||
if (!input.getRev() || input.getRev() == rev2) {
|
if (!input.getRev() || input.getRev() == rev2) {
|
||||||
input.attrs.insert_or_assign("rev", rev2.gitRev());
|
input.attrs.insert_or_assign("rev", rev2.gitRev());
|
||||||
|
@ -277,7 +277,7 @@ struct MercurialInputScheme : InputScheme
|
||||||
auto revCount = std::stoull(tokens[1]);
|
auto revCount = std::stoull(tokens[1]);
|
||||||
input.attrs.insert_or_assign("ref", tokens[2]);
|
input.attrs.insert_or_assign("ref", tokens[2]);
|
||||||
|
|
||||||
if (auto res = getCache()->lookup(store, getImmutableAttrs()))
|
if (auto res = getCache()->lookup(store, getLockedAttrs()))
|
||||||
return makeResult(res->first, std::move(res->second));
|
return makeResult(res->first, std::move(res->second));
|
||||||
|
|
||||||
Path tmpDir = createTempDir();
|
Path tmpDir = createTempDir();
|
||||||
|
@ -297,14 +297,14 @@ struct MercurialInputScheme : InputScheme
|
||||||
if (!_input.getRev())
|
if (!_input.getRev())
|
||||||
getCache()->add(
|
getCache()->add(
|
||||||
store,
|
store,
|
||||||
mutableAttrs,
|
unlockedAttrs,
|
||||||
infoAttrs,
|
infoAttrs,
|
||||||
storePath,
|
storePath,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
getCache()->add(
|
getCache()->add(
|
||||||
store,
|
store,
|
||||||
getImmutableAttrs(),
|
getLockedAttrs(),
|
||||||
infoAttrs,
|
infoAttrs,
|
||||||
storePath,
|
storePath,
|
||||||
true);
|
true);
|
||||||
|
|
|
@ -13,7 +13,7 @@ DownloadFileResult downloadFile(
|
||||||
ref<Store> store,
|
ref<Store> store,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::string & name,
|
const std::string & name,
|
||||||
bool immutable,
|
bool locked,
|
||||||
const Headers & headers)
|
const Headers & headers)
|
||||||
{
|
{
|
||||||
// FIXME: check store
|
// FIXME: check store
|
||||||
|
@ -88,7 +88,7 @@ DownloadFileResult downloadFile(
|
||||||
inAttrs,
|
inAttrs,
|
||||||
infoAttrs,
|
infoAttrs,
|
||||||
*storePath,
|
*storePath,
|
||||||
immutable);
|
locked);
|
||||||
|
|
||||||
if (url != res.effectiveUri)
|
if (url != res.effectiveUri)
|
||||||
getCache()->add(
|
getCache()->add(
|
||||||
|
@ -100,7 +100,7 @@ DownloadFileResult downloadFile(
|
||||||
},
|
},
|
||||||
infoAttrs,
|
infoAttrs,
|
||||||
*storePath,
|
*storePath,
|
||||||
immutable);
|
locked);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
.storePath = std::move(*storePath),
|
.storePath = std::move(*storePath),
|
||||||
|
@ -113,7 +113,7 @@ std::pair<Tree, time_t> downloadTarball(
|
||||||
ref<Store> store,
|
ref<Store> store,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::string & name,
|
const std::string & name,
|
||||||
bool immutable,
|
bool locked,
|
||||||
const Headers & headers)
|
const Headers & headers)
|
||||||
{
|
{
|
||||||
Attrs inAttrs({
|
Attrs inAttrs({
|
||||||
|
@ -130,7 +130,7 @@ std::pair<Tree, time_t> downloadTarball(
|
||||||
getIntAttr(cached->infoAttrs, "lastModified")
|
getIntAttr(cached->infoAttrs, "lastModified")
|
||||||
};
|
};
|
||||||
|
|
||||||
auto res = downloadFile(store, url, name, immutable, headers);
|
auto res = downloadFile(store, url, name, locked, headers);
|
||||||
|
|
||||||
std::optional<StorePath> unpackedStorePath;
|
std::optional<StorePath> unpackedStorePath;
|
||||||
time_t lastModified;
|
time_t lastModified;
|
||||||
|
@ -160,7 +160,7 @@ std::pair<Tree, time_t> downloadTarball(
|
||||||
inAttrs,
|
inAttrs,
|
||||||
infoAttrs,
|
infoAttrs,
|
||||||
*unpackedStorePath,
|
*unpackedStorePath,
|
||||||
immutable);
|
locked);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Tree { .actualPath = store->toRealPath(*unpackedStorePath), .storePath = std::move(*unpackedStorePath) },
|
Tree { .actualPath = store->toRealPath(*unpackedStorePath), .storePath = std::move(*unpackedStorePath) },
|
||||||
|
@ -202,7 +202,7 @@ struct TarballInputScheme : InputScheme
|
||||||
|
|
||||||
Input input;
|
Input input;
|
||||||
input.attrs = attrs;
|
input.attrs = attrs;
|
||||||
//input.immutable = (bool) maybeGetStrAttr(input.attrs, "hash");
|
//input.locked = (bool) maybeGetStrAttr(input.attrs, "hash");
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
|
||||||
for (size_t i = 0; i < manifest.elements.size(); ++i) {
|
for (size_t i = 0; i < manifest.elements.size(); ++i) {
|
||||||
auto & element(manifest.elements[i]);
|
auto & element(manifest.elements[i]);
|
||||||
if (element.source
|
if (element.source
|
||||||
&& !element.source->originalRef.input.isImmutable()
|
&& !element.source->originalRef.input.isLocked()
|
||||||
&& matches(*store, element, i, matchers))
|
&& matches(*store, element, i, matchers))
|
||||||
{
|
{
|
||||||
upgradedCount++;
|
upgradedCount++;
|
||||||
|
|
|
@ -627,8 +627,8 @@ void NixRepl::loadFlake(const std::string & flakeRefS)
|
||||||
throw Error("cannot use ':load-flake' without a path specified. (Use '.' for the current working directory.)");
|
throw Error("cannot use ':load-flake' without a path specified. (Use '.' for the current working directory.)");
|
||||||
|
|
||||||
auto flakeRef = parseFlakeRef(flakeRefS, absPath("."), true);
|
auto flakeRef = parseFlakeRef(flakeRefS, absPath("."), true);
|
||||||
if (evalSettings.pureEval && !flakeRef.input.isImmutable())
|
if (evalSettings.pureEval && !flakeRef.input.isLocked())
|
||||||
throw Error("cannot use ':load-flake' on mutable flake reference '%s' (use --impure to override)", flakeRefS);
|
throw Error("cannot use ':load-flake' on locked flake reference '%s' (use --impure to override)", flakeRefS);
|
||||||
|
|
||||||
Value v;
|
Value v;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue