{ lib, stdenv, rustPlatform, fetchFromGitHub, installShellFiles, gitMinimal, gnupg, openssh, buildPackages, nix-update-script, versionCheckHook, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "jujutsu"; version = "0.32.0"; src = fetchFromGitHub { owner = "jj-vcs"; repo = "jj"; tag = "v${finalAttrs.version}"; hash = "sha256-TFKUz8hUCRM9RPkp9CBvKnd4e+TnR8H5t9/N76cAKzI="; }; cargoHash = "sha256-QWbAXqOysIZ7vUeBqAL/iP2QJBHgkZwjsUIregPNezg="; nativeBuildInputs = [ installShellFiles ]; nativeCheckInputs = [ gitMinimal gnupg openssh ]; cargoBuildFlags = [ # Don’t install the `gen-protos` build tool. "--bin" "jj" ]; useNextest = true; cargoTestFlags = [ # Don’t build the `gen-protos` build tool when running tests. "-p" "jj-lib" "-p" "jj-cli" ]; # taplo-cli (used in tests) always creates a reqwest client, which # requires configd access on macOS. sandboxProfile = '' (allow mach-lookup (global-name "com.apple.SystemConfiguration.configd")) ''; env = { # Disable vendored libraries. ZSTD_SYS_USE_PKG_CONFIG = "1"; LIBGIT2_NO_VENDOR = "1"; LIBSSH2_SYS_USE_PKG_CONFIG = "1"; }; postInstall = let jj = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/jj"; in lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' mkdir -p $out/share/man ${jj} util install-man-pages $out/share/man/ installShellCompletion --cmd jj \ --bash <(COMPLETE=bash ${jj}) \ --fish <(COMPLETE=fish ${jj}) \ --zsh <(COMPLETE=zsh ${jj}) ''; doInstallCheck = true; nativeInstallCheckInputs = [ versionCheckHook ]; versionCheckProgram = "${placeholder "out"}/bin/jj"; versionCheckProgramArg = "--version"; passthru = { updateScript = nix-update-script { }; }; meta = { description = "Git-compatible DVCS that is both simple and powerful"; homepage = "https://github.com/jj-vcs/jj"; changelog = "https://github.com/jj-vcs/jj/blob/v${finalAttrs.version}/CHANGELOG.md"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ _0x4A6F thoughtpolice emily bbigras ]; mainProgram = "jj"; }; })