--override-input: Imply --no-write-lock-file

Fixes #3779.
This commit is contained in:
Eelco Dolstra 2021-03-16 16:53:39 +01:00
parent 338f271058
commit 77f5d171e1
2 changed files with 12 additions and 1 deletions

View file

@ -111,10 +111,11 @@ MixFlakeOptions::MixFlakeOptions()
addFlag({ addFlag({
.longName = "override-input", .longName = "override-input",
.description = "Override a specific flake input (e.g. `dwarffs/nixpkgs`).", .description = "Override a specific flake input (e.g. `dwarffs/nixpkgs`). This implies `--no-write-lock-file`.",
.category = category, .category = category,
.labels = {"input-path", "flake-url"}, .labels = {"input-path", "flake-url"},
.handler = {[&](std::string inputPath, std::string flakeRef) { .handler = {[&](std::string inputPath, std::string flakeRef) {
lockFlags.writeLockFile = false;
lockFlags.inputOverrides.insert_or_assign( lockFlags.inputOverrides.insert_or_assign(
flake::parseInputPath(inputPath), flake::parseInputPath(inputPath),
parseFlakeRef(flakeRef, absPath("."))); parseFlakeRef(flakeRef, absPath(".")));

View file

@ -110,6 +110,7 @@ struct CmdFlakeUpdate : FlakeCommand
removeFlag("recreate-lock-file"); removeFlag("recreate-lock-file");
removeFlag("update-input"); removeFlag("update-input");
removeFlag("no-update-lock-file"); removeFlag("no-update-lock-file");
removeFlag("no-write-lock-file");
} }
std::string doc() override std::string doc() override
@ -124,6 +125,7 @@ struct CmdFlakeUpdate : FlakeCommand
settings.tarballTtl = 0; settings.tarballTtl = 0;
lockFlags.recreateLockFile = true; lockFlags.recreateLockFile = true;
lockFlags.writeLockFile = true;
lockFlake(); lockFlake();
} }
@ -136,6 +138,12 @@ struct CmdFlakeLock : FlakeCommand
return "create missing lock file entries"; return "create missing lock file entries";
} }
CmdFlakeLock()
{
/* Remove flags that don't make sense. */
removeFlag("no-write-lock-file");
}
std::string doc() override std::string doc() override
{ {
return return
@ -147,6 +155,8 @@ struct CmdFlakeLock : FlakeCommand
{ {
settings.tarballTtl = 0; settings.tarballTtl = 0;
lockFlags.writeLockFile = true;
lockFlake(); lockFlake();
} }
}; };