Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Lean
/.lake
# Local clone for Lake build
/blake3

# Rust
**/target
Expand Down
7 changes: 3 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down Expand Up @@ -128,9 +130,6 @@
buildLibrary = true;
postPatch = disableGitClone;
preConfigure = linkBlake3Src;
postInstall = ''
cp -rP ./blake3 $out
'';
};

blake3Rust = lake2nix.mkPackage {
Expand Down
6 changes: 5 additions & 1 deletion lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down