mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
More rename mutable/immutable -> unlocked/locked
This commit is contained in:
parent
4bc65d45d6
commit
04d5417755
10 changed files with 23 additions and 23 deletions
|
@ -776,7 +776,7 @@ void NixRepl::loadFlake(const std::string & flakeRefS)
|
|||
flake::LockFlags {
|
||||
.updateLockFile = false,
|
||||
.useRegistries = !evalSettings.pureEval,
|
||||
.allowMutable = !evalSettings.pureEval,
|
||||
.allowUnlocked = !evalSettings.pureEval,
|
||||
}),
|
||||
v);
|
||||
addAttrsToScope(v);
|
||||
|
|
|
@ -541,8 +541,8 @@ LockedFlake lockFlake(
|
|||
this input. */
|
||||
debug("creating new input '%s'", inputPathS);
|
||||
|
||||
if (!lockFlags.allowMutable && !input.ref->input.isLocked())
|
||||
throw Error("cannot update flake input '%s' in pure mode", inputPathS);
|
||||
if (!lockFlags.allowUnlocked && !input.ref->input.isLocked())
|
||||
throw Error("cannot update unlocked flake input '%s' in pure mode", inputPathS);
|
||||
|
||||
if (input.isFlake) {
|
||||
auto localPath(parentPath);
|
||||
|
@ -628,9 +628,9 @@ LockedFlake lockFlake(
|
|||
|
||||
if (lockFlags.writeLockFile) {
|
||||
if (auto sourcePath = topRef.input.getSourcePath()) {
|
||||
if (!newLockFile.isImmutable()) {
|
||||
if (!newLockFile.isLocked()) {
|
||||
if (fetchSettings.warnDirty)
|
||||
warn("will not write lock file of flake '%s' because it has a mutable input", topRef);
|
||||
warn("will not write lock file of flake '%s' because it has an unlocked input", topRef);
|
||||
} else {
|
||||
if (!lockFlags.updateLockFile)
|
||||
throw Error("flake '%s' requires lock file changes but they're not allowed due to '--no-update-lock-file'", topRef);
|
||||
|
@ -755,7 +755,7 @@ static void prim_getFlake(EvalState & state, const PosIdx pos, Value * * args, V
|
|||
.updateLockFile = false,
|
||||
.writeLockFile = false,
|
||||
.useRegistries = !evalSettings.pureEval && fetchSettings.useRegistries,
|
||||
.allowMutable = !evalSettings.pureEval,
|
||||
.allowUnlocked = !evalSettings.pureEval,
|
||||
}),
|
||||
v);
|
||||
}
|
||||
|
|
|
@ -108,11 +108,11 @@ struct LockFlags
|
|||
|
||||
bool applyNixConfig = false;
|
||||
|
||||
/* Whether mutable flake references (i.e. those without a Git
|
||||
/* Whether unlocked flake references (i.e. those without a Git
|
||||
revision or similar) without a corresponding lock are
|
||||
allowed. Mutable flake references with a lock are always
|
||||
allowed. Unlocked flake references with a lock are always
|
||||
allowed. */
|
||||
bool allowMutable = true;
|
||||
bool allowUnlocked = true;
|
||||
|
||||
/* Whether to commit changes to flake.lock. */
|
||||
bool commitLockFile = false;
|
||||
|
|
|
@ -36,7 +36,7 @@ LockedNode::LockedNode(const nlohmann::json & json)
|
|||
, isFlake(json.find("flake") != json.end() ? (bool) json["flake"] : true)
|
||||
{
|
||||
if (!lockedRef.input.isLocked())
|
||||
throw Error("lockfile contains mutable lock '%s'",
|
||||
throw Error("lock file contains unlocked input '%s'",
|
||||
fetchers::attrsToJSON(lockedRef.input.toAttrs()));
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ void LockFile::write(const Path & path) const
|
|||
writeFile(path, fmt("%s\n", *this));
|
||||
}
|
||||
|
||||
bool LockFile::isImmutable() const
|
||||
bool LockFile::isLocked() const
|
||||
{
|
||||
std::unordered_set<std::shared_ptr<const Node>> nodes;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ struct LockFile
|
|||
|
||||
void write(const Path & path) const;
|
||||
|
||||
bool isImmutable() const;
|
||||
bool isLocked() const;
|
||||
|
||||
bool operator ==(const LockFile & other) const;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ R""(
|
|||
# Description
|
||||
|
||||
This command recreates the lock file of a flake (`flake.lock`), thus
|
||||
updating the lock for every mutable input (like `nixpkgs`) to its
|
||||
updating the lock for every unlocked input (like `nixpkgs`) to its
|
||||
current version. This is equivalent to passing `--recreate-lock-file`
|
||||
to any command that operates on a flake. That is,
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ following fields:
|
|||
* An integer that can be used to unambiguously identify the package in
|
||||
invocations of `nix profile remove` and `nix profile upgrade`.
|
||||
|
||||
* The original ("mutable") flake reference and output attribute path
|
||||
* The original ("unlocked") flake reference and output attribute path
|
||||
used at installation time.
|
||||
|
||||
* The immutable flake reference to which the mutable flake reference
|
||||
was resolved.
|
||||
* The locked flake reference to which the unlocked flake reference was
|
||||
resolved.
|
||||
|
||||
* The store path(s) of the package.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ R""(
|
|||
|
||||
# Examples
|
||||
|
||||
* Upgrade all packages that were installed using a mutable flake
|
||||
* Upgrade all packages that were installed using an unlocked flake
|
||||
reference:
|
||||
|
||||
```console
|
||||
|
@ -32,9 +32,9 @@ the package was installed.
|
|||
|
||||
> **Warning**
|
||||
>
|
||||
> This only works if you used a *mutable* flake reference at
|
||||
> This only works if you used an *unlocked* flake reference at
|
||||
> installation time, e.g. `nixpkgs#hello`. It does not work if you
|
||||
> used an *immutable* flake reference
|
||||
> used a *locked* flake reference
|
||||
> (e.g. `github:NixOS/nixpkgs/13d0c311e3ae923a00f734b43fd1d35b47d8943a#hello`),
|
||||
> since in that case the "latest version" is always the same.
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@ has the following fields:
|
|||
the user at the time of installation (e.g. `nixpkgs`). This is also
|
||||
the flake reference that will be used by `nix profile upgrade`.
|
||||
|
||||
* `uri`: The immutable flake reference to which `originalUrl`
|
||||
resolved.
|
||||
* `uri`: The locked flake reference to which `originalUrl` resolved.
|
||||
|
||||
* `attrPath`: The flake output attribute that provided this
|
||||
package. Note that this is not necessarily the attribute that the
|
||||
|
|
|
@ -148,11 +148,12 @@ nix build -o $TEST_ROOT/result git+file://$flake1Dir
|
|||
nix build -o $flake1Dir/result git+file://$flake1Dir
|
||||
nix path-info $flake1Dir/result
|
||||
|
||||
# 'getFlake' on a mutable flakeref should fail in pure mode, but succeed in impure mode.
|
||||
# 'getFlake' on an unlocked flakeref should fail in pure mode, but
|
||||
# succeed in impure mode.
|
||||
(! nix build -o $TEST_ROOT/result --expr "(builtins.getFlake \"$flake1Dir\").packages.$system.default")
|
||||
nix build -o $TEST_ROOT/result --expr "(builtins.getFlake \"$flake1Dir\").packages.$system.default" --impure
|
||||
|
||||
# 'getFlake' on an immutable flakeref should succeed even in pure mode.
|
||||
# 'getFlake' on a locked flakeref should succeed even in pure mode.
|
||||
nix build -o $TEST_ROOT/result --expr "(builtins.getFlake \"git+file://$flake1Dir?rev=$hash2\").packages.$system.default"
|
||||
|
||||
# Building a flake with an unlocked dependency should fail in pure mode.
|
||||
|
|
Loading…
Reference in a new issue