diff --git a/pkgs/by-name/gi/git-branchless/fix-esl01-indexedlog-for-rust-1_89.patch b/pkgs/by-name/gi/git-branchless/fix-esl01-indexedlog-for-rust-1_89.patch new file mode 100644 index 000000000000..c5b03dc82d3d --- /dev/null +++ b/pkgs/by-name/gi/git-branchless/fix-esl01-indexedlog-for-rust-1_89.patch @@ -0,0 +1,18 @@ +diff --git a/src/lock.rs b/src/lock.rs +--- a/src/lock.rs ++++ b/src/lock.rs +@@ -132,10 +132,10 @@ impl ScopedDirLock { + + // Lock + match (opts.exclusive, opts.non_blocking) { +- (true, false) => file.lock_exclusive(), +- (true, true) => file.try_lock_exclusive(), +- (false, false) => file.lock_shared(), +- (false, true) => file.try_lock_shared(), ++ (true, false) => fs2::FileExt::lock_exclusive(&file), ++ (true, true) => fs2::FileExt::try_lock_exclusive(&file), ++ (false, false) => fs2::FileExt::lock_shared(&file), ++ (false, true) => fs2::FileExt::try_lock_shared(&file), + } + .context(&path, || { + format!( diff --git a/pkgs/by-name/gi/git-branchless/package.nix b/pkgs/by-name/gi/git-branchless/package.nix index 2355d30ee5dd..6e7946dd45f3 100644 --- a/pkgs/by-name/gi/git-branchless/package.nix +++ b/pkgs/by-name/gi/git-branchless/package.nix @@ -21,6 +21,20 @@ rustPlatform.buildRustPackage rec { hash = "sha256-8uv+sZRr06K42hmxgjrKk6FDEngUhN/9epixRYKwE3U="; }; + # Patch the vendored esl01-indexedlog crate. + # This is necessary to fix the build for rust 1.89. See: + # - https://github.com/NixOS/nixpkgs/issues/437051 + # - https://github.com/arxanas/git-branchless/issues/1585 + # - https://github.com/facebook/sapling/issues/1119 + # The patch is derived from: + # - https://github.com/facebook/sapling/commit/9e27acb84605079bf4e305afb637a4d6801831ac + postPatch = '' + ( + cd ../git-branchless-*-vendor/esl01-indexedlog-*/ + patch -p1 < ${./fix-esl01-indexedlog-for-rust-1_89.patch} + ) + ''; + cargoHash = "sha256-i7KpTd4fX3PrhDjj3R9u98rdI0uHkpQCxSmEF+Gu7yk="; nativeBuildInputs = [ pkg-config ];