104 lines
2.3 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
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 = [
# Dont install the `gen-protos` build tool.
"--bin"
"jj"
];
useNextest = true;
cargoTestFlags = [
# Dont 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";
};
})