diff --git a/.gitignore b/.gitignore index c908d25..2e36d3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ # Lean /.lake -# Local clone for Lake build -/blake3 # Rust **/target diff --git a/flake.nix b/flake.nix index b8b4178..67f3a2c 100644 --- a/flake.nix +++ b/flake.nix @@ -76,8 +76,10 @@ disableCargoBuild = '' substituteInPlace lakefile.lean --replace-fail 'proc { cmd := "cargo"' '--proc { cmd := "cargo"' ''; + # `-fn` so it overwrites the symlink rsynced in from a prior stage's `.lake` linkBlake3Src = '' - ln -s ${blake3.outPath} ./blake3 + mkdir -p .lake + ln -sfn ${blake3.outPath} .lake/blake3-source ''; # Copy the `blake3_rs` static lib from Crane to `target/release` so Lake can use it linkRustLib = '' @@ -128,9 +130,6 @@ buildLibrary = true; postPatch = disableGitClone; preConfigure = linkBlake3Src; - postInstall = '' - cp -rP ./blake3 $out - ''; }; blake3Rust = lake2nix.mkPackage { diff --git a/lakefile.lean b/lakefile.lean index e8900fc..c8a5fe4 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -15,7 +15,11 @@ abbrev blake3RepoURL := "https://github.com/BLAKE3-team/BLAKE3" abbrev blake3RepoTag := "1.8.7" target cloneBlake3 pkg : GitRepo := do - let repoDir : GitRepo := pkg.dir / "blake3" + -- Under `.lake` rather than the package root: it is already untracked, and a + -- sibling `blake3` directory would collide with `Blake3` on case-insensitive + -- filesystems (macOS, Windows). `lake clean` only clears `.lake/build`, so the + -- clone survives. + let repoDir : GitRepo := pkg.lakeDir / "blake3-source" -- Clone if it hasn't already been cloned let alreadyCloned ← repoDir.dir.pathExists