nixpkgs/pkgs/applications/version-management/pijul/default.nix
Michael Weiss 434ff94e73
pijul: Fix the build (broke due to a more recent Rust version)
This uses an upstream patch [0] to fix a compatibility error with a new
version of Rust. Fix #79150.

Unfortunately patching Rust dependencies in Nixpkgs turned out to be way
more hacky than I expected (maybe there is a nicer way?), but it should
be fine for now.

A new release might follow soonish [1] so that we can drop the patches.

References:
- https://nest.pijul.com/pijul_org/pijul/discussions/401
- https://nest.pijul.com/pijul_org/thrussh/discussions/31

[0]: https://nest.pijul.com/pijul_org/thrussh:master/patches/AsyuWkJg4jAwNaG3H1yv1kbECx5E3GQAtjzXWBDB8yEGMswyfKbxKvYmAGWCohTVaTipdvF8mHh63yU5PTr5F9py
[1]: https://discourse.pijul.org/t/is-this-project-still-active-yes-it-is/451
2020-02-04 14:05:02 +01:00

58 lines
2.0 KiB
Nix

{ stdenv, fetchurl, rustPlatform, darwin, openssl, libsodium, nettle, clang, libclang, pkgconfig }:
let
# nettle-sys=1.0.1 requires the des-compat.h header, but it was removed in
# nettle 3.5. See https://nest.pijul.com/pijul_org/pijul/discussions/416
# Remove with the next release
nettle_34 = nettle.overrideAttrs (_oldAttrs: rec {
version = "3.4.1";
src = fetchurl {
url = "mirror://gnu/nettle/nettle-${version}.tar.gz";
sha256 = "1bcji95n1iz9p9vsgdgr26v6s7zhpsxfbjjwpqcihpfd6lawyhgr";
};
});
in rustPlatform.buildRustPackage rec {
pname = "pijul";
version = "0.12.0";
src = fetchurl {
url = "https://pijul.org/releases/${pname}-${version}.tar.gz";
sha256 = "1rm787kkh3ya8ix0rjvj7sbrg9armm0rnpkga6gjmsbg5bx20y4q";
};
postPatch = ''
pushd ../${pname}-${version}-vendor/thrussh/
patch -p1 < ${./thrussh-build-fix.patch}
substituteInPlace .cargo-checksum.json --replace \
9696ed2422a483cd8de48ac241178a0441be6636909c76174c536b8b1cba9d45 \
a199f2bba520d56e11607b77be4dde0cfae576c90badb9fbd39af4784e8120d1
popd
'';
nativeBuildInputs = [ pkgconfig clang ];
postInstall = ''
mkdir -p $out/share/{bash-completion/completions,zsh/site-functions,fish/vendor_completions.d}
$out/bin/pijul generate-completions --bash > $out/share/bash-completion/completions/pijul
$out/bin/pijul generate-completions --zsh > $out/share/zsh/site-functions/_pijul
$out/bin/pijul generate-completions --fish > $out/share/fish/vendor_completions.d/pijul.fish
'';
LIBCLANG_PATH = libclang + "/lib";
buildInputs = [ openssl libsodium nettle_34 libclang ] ++ stdenv.lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ CoreServices Security ]);
doCheck = false;
cargoSha256 = "1w77s5q18yr1gqqif15wmrfdvv2chq8rq3w4dnmxg2gn0r7bmz2k";
meta = with stdenv.lib; {
description = "A distributed version control system";
homepage = https://pijul.org;
license = with licenses; [ gpl2Plus ];
maintainers = [ maintainers.gal_bolle ];
platforms = platforms.all;
};
}