Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix: use a crane dummy source for the vendored patch to skim (#2265)

Nick Dichevb1cea9cae547
diff --git a/flake.lock b/flake.lock
index e2b847ad7..e50c74c63 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"crane": {
"locked": {
- "lastModified": 1767744144,
- "narHash": "sha256-9/9ntI0D+HbN4G0TrK3KmHbTvwgswz7p8IEJsWyef8Q=",
+ "lastModified": 1775839657,
+ "narHash": "sha256-SPm9ck7jh3Un9nwPuMGbRU04UroFmOHjLP56T10MOeM=",
"owner": "ipetkov",
"repo": "crane",
- "rev": "2fb033290bf6b23f226d4c8b32f7f7a16b043d7e",
+ "rev": "7cf72d978629469c4bd4206b95c402514c1f6000",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index fdfc39471..f237986cc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -49,6 +49,19 @@
|| (baseNameOf (dirOf p) == "dev");
};
+ # Vendored path dependencies (vendor/skim-tuikit) need their real
+ # source preserved during buildDepsOnly — crane's mkDummySrc stubs
+ # all .rs files, but [patch.crates-io] path deps must compile for
+ # downstream crates (skim) to resolve their imports. Kept as a
+ # separate derivation so non-vendor source edits don't invalidate
+ # the dependency cache.
+ vendorSrc = pkgs.lib.cleanSourceWith {
+ src = ./.;
+ filter =
+ path: _type:
+ pkgs.lib.hasInfix "/vendor/" path || pkgs.lib.hasSuffix "/vendor" path;
+ };
+
# Common arguments for crane builds
commonArgs = {
inherit src;
@@ -78,8 +91,22 @@
self.shortRev or self.dirtyShortRev or "nix-${self.lastModifiedDate or "unknown"}";
};
- # Build just the cargo dependencies for caching
- cargoArtifacts = craneLib.buildDepsOnly commonArgs;
+ # Build just the cargo dependencies for caching.
+ # extraDummyScript restores vendor/ after mkDummySrc stubs all .rs
+ # files — without this, [patch.crates-io] path deps are empty crates.
+ cargoArtifacts = craneLib.buildDepsOnly (
+ commonArgs
+ // {
+ dummySrc = craneLib.mkDummySrc {
+ src = commonArgs.src;
+ extraDummyScript = ''
+ rm -rf $out/vendor
+ cp -r ${vendorSrc}/vendor $out/vendor
+ chmod -R u+w $out/vendor
+ '';
+ };
+ }
+ );
# Build the actual package
worktrunk = craneLib.buildPackage (