From 24fd14b1e6de45def6a59b65486f5035ac486ee3 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 13 Nov 2026 20:28:00 +0000 Subject: populate: refer to flakes as git+file: only with a usable .git Writing the lock file of a git+file: flake, Nix runs Git, with the repository's configuration and hooks, which may run commands. A .git in a source's directory can come from anywhere, e.g. one planted in a materialized flake, or one a file source keeps. So drawing inputs refers to a flake as git+file: only if git_problems finds nothing wrong with its .git directory, the way git sources check their work trees, and else as path:. lock-foreign-git plants a .git in a materialized flake and in a file source that keeps it, whose configuration names an fsmonitor command. --- pkgs/populate/src/flake.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkgs/populate/src/flake.rs') diff --git a/pkgs/populate/src/flake.rs b/pkgs/populate/src/flake.rs index 26373d4..ded7692 100644 --- a/pkgs/populate/src/flake.rs +++ b/pkgs/populate/src/flake.rs @@ -228,8 +228,9 @@ impl<'a> Flakes<'a> { String::new() }; format!( - "{}{}{require}{snippet}", + "{}{}{}{require}{snippet}", sh::prelude(), + sh::GIT_PROBLEMS, sh::draw::DEFINITIONS ) } @@ -270,7 +271,8 @@ impl<'a> Flakes<'a> { .collect()) } - /// The flake URL of the source named name, at resolved. + /// The flake URL of the source named name, at resolved: git+file: if + /// it has a .git directory populate can use, else path:. fn flake_url(name: &str, resolved: &Resolved) -> Result { if !resolved.dir { return Err(Failure::Message(format!( -- cgit v1.3.1