aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/flake.hh
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2023-03-13 21:08:52 +0100
committerLinus Heckemann <git@sphalerite.org>2023-03-13 21:08:52 +0100
commite91596eb6922157aaba17a858dc52244dd0e5688 (patch)
treefafdbbca4cc58a3011ed25d5ba0ef50178c04276 /src/libexpr/flake/flake.hh
parent4a96125c3cbcb91eebb6ebda044841f3fab3bf21 (diff)
Allow specifying alternative paths for reading/writing flake locks
This allows having multiple separate lockfiles for a single project, which can be useful for testing against different versions of nixpkgs; it also allows tracking custom input overrides for remote flakes without requiring local clones of these flakes. For example, if I want to build Nix against my locally pinned nixpkgs, and have a lock file tracking this override independently of future updates to said nixpkgs: nix flake lock --output-lock-file /tmp/nix-flake.lock --override-input nixpkgs flake:nixpkgs nix build --reference-lock-file /tmp/nix-flake.lock Co-Authored-By: Will Fancher <elvishjerricco@gmail.com>
Diffstat (limited to 'src/libexpr/flake/flake.hh')
-rw-r--r--src/libexpr/flake/flake.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libexpr/flake/flake.hh b/src/libexpr/flake/flake.hh
index 10301d8aa..b5db56312 100644
--- a/src/libexpr/flake/flake.hh
+++ b/src/libexpr/flake/flake.hh
@@ -117,6 +117,12 @@ struct LockFlags
/* Whether to commit changes to flake.lock. */
bool commitLockFile = false;
+ /* The path to a lock file to read instead of the `flake.lock` file in the top-level flake */
+ std::optional<std::string> referenceLockFilePath = std::nullopt;
+
+ /* The path to a lock file to write to instead of the `flake.lock` file in the top-level flake */
+ std::optional<Path> outputLockFilePath = std::nullopt;
+
/* Flake inputs to be overridden. */
std::map<InputPath, FlakeRef> inputOverrides;