From 361b504079389cfd6f8cf3160da96b88cc5e5a69 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 14 Nov 2026 01:24:34 +0000 Subject: populate: tell whether a Git work tree drawn from changed by its commit Whether a derived copy of a flake or flake-input source needs to be made again depends on the sources it draws inputs from. For one that isn't in the store, the key had its hash, so every run read all of it, e.g. all of a nixpkgs work tree, .git included, which takes long even when nothing changed. For a Git work tree that Nix gets as git+file:, whose commit and tracked files are all Nix uses, the key has its commit instead, if no tracked file differs from it, which Git tells quickly. git_flake decides what Nix gets as git+file:, for resolve as well. Keys of copies drawing from such work trees change once, so those copies get made again on the first run, also after deploying with krops 1. rewrite-cache-git checks that such a copy gets made again for a new commit, but not for redeploying, nor for an untracked file. --- pkgs/populate/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pkgs/populate/README.md') diff --git a/pkgs/populate/README.md b/pkgs/populate/README.md index f96ef49..63ec6bd 100644 --- a/pkgs/populate/README.md +++ b/pkgs/populate/README.md @@ -559,7 +559,9 @@ see [The target directory](#the-target-directory), and has no hooks. Lock files get rewritten or generated on every run, so they match the sources. Copies of `flake` and `flake-input` sources get made again only if the delivered store path, the patches, or the sources they draw inputs from -change. Inputs that get drawn from other sources don't get delivered with +change. For a source in a Git work tree that Nix gets as `git+file:`, +that's its commit and tracked files, which populate checks with Git; +other sources get read entirely, to hash them. Inputs that get drawn from other sources don't get delivered with a `flake` or `flake-input` source, and neither does what they pin. Generated flakes and copies get removed once their sources no longer need them. This requires Nix with flake support (Nix 2.4 or later) on the -- cgit v1.3.1