From 0869356f401ae5bb75c15f7b8ba526e2f8767426 Mon Sep 17 00:00:00 2001 From: Brian Lyles Date: Wed, 31 Dec 2025 15:13:31 -0600 Subject: [PATCH] git: add rust opt-in With v2.52.0, git now includes the option to use a rust implementation of some core logic [1]. Using rust/cargo as part of the build process is currently still optional, though expected to become mandatory in Git v3.0. In preparation, introduce cargo/rustc into the Git package build. This is disabled by default and enabled via a new `rustSupport` argument to mirror the fact that this is opt-in in Git itself. [1]: lore.kernel.org/git/20251002-b4-pks-rust-breaking-change-v8-0-3a89fd5b1ce7@pks.im/ --- pkgs/by-name/gi/git/package.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/gi/git/package.nix b/pkgs/by-name/gi/git/package.nix index 6476d005edfe..3985c60ff0a9 100644 --- a/pkgs/by-name/gi/git/package.nix +++ b/pkgs/by-name/gi/git/package.nix @@ -51,6 +51,9 @@ deterministic-host-uname, # trick Makefile into targeting the host platform when cross-compiling doInstallCheck ? !stdenv.hostPlatform.isDarwin, # extremely slow on darwin tests, + rustSupport ? false, + cargo, + rustc, }: assert osxkeychainSupport -> stdenv.hostPlatform.isDarwin; @@ -186,6 +189,10 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals withLibsecret [ glib libsecret + ] + ++ lib.optionals rustSupport [ + cargo + rustc ]; # required to support pthread_cancel() @@ -234,7 +241,9 @@ stdenv.mkDerivation (finalAttrs: { # acceptable version. # # See https://github.com/Homebrew/homebrew-core/commit/dfa3ccf1e7d3901e371b5140b935839ba9d8b706 - ++ lib.optional stdenv.hostPlatform.isDarwin "TKFRAMEWORK=/nonexistent"; + ++ lib.optional stdenv.hostPlatform.isDarwin "TKFRAMEWORK=/nonexistent" + # Starting with future Git version 3.0.0, rust will be mandatory. For now, it's optional. + ++ lib.optional rustSupport "WITH_RUST=YesPlease"; disallowedReferences = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ stdenv.shellPackage