aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/src/flake.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-13 20:28:00 +0000
committertv <tv@krebsco.de>2026-11-13 21:59:13 +0100
commit24fd14b1e6de45def6a59b65486f5035ac486ee3 (patch)
treeff9928227578c3befa83bfcdee41548aa978efe8 /pkgs/populate/src/flake.rs
parentb34f53d538c5afa95fd0dc6dd81b56e4995b80c2 (diff)
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.
Diffstat (limited to 'pkgs/populate/src/flake.rs')
-rw-r--r--pkgs/populate/src/flake.rs6
1 files changed, 4 insertions, 2 deletions
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<String> {
if !resolved.dir {
return Err(Failure::Message(format!(