2019-07-31 10:07:19 +02:00
|
|
|
{ stdenv, fetchFromGitLab, lib, darwin
|
|
|
|
, git, nettle, llvmPackages, cargo, rustc
|
|
|
|
, rustPlatform, pkgconfig, glib
|
|
|
|
, openssl, sqlite, capnproto
|
|
|
|
, ensureNewerSourcesForZipFilesHook, pythonSupport ? true, pythonPackages ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert pythonSupport -> pythonPackages != null;
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "sequoia";
|
2020-08-14 19:26:05 +02:00
|
|
|
version = "0.18.0";
|
2019-07-31 10:07:19 +02:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "sequoia-pgp";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2020-08-14 19:26:05 +02:00
|
|
|
sha256 = "18acv0185y51yz6jwchi1vf701shz37z5qmnzpq6z419lpjdaskd";
|
2019-07-31 10:07:19 +02:00
|
|
|
};
|
|
|
|
|
2020-08-14 19:26:05 +02:00
|
|
|
cargoSha256 = "1jazwpv5mrsd0hxfavk0lvq8n26iglzl8pggw311ysi0lwabjq0y";
|
2019-07-31 10:07:19 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgconfig
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
git
|
|
|
|
llvmPackages.libclang
|
|
|
|
llvmPackages.clang
|
|
|
|
ensureNewerSourcesForZipFilesHook
|
2020-03-29 10:23:57 +02:00
|
|
|
capnproto
|
2019-07-31 10:07:19 +02:00
|
|
|
] ++
|
|
|
|
lib.optionals pythonSupport [ pythonPackages.setuptools ]
|
|
|
|
;
|
|
|
|
|
|
|
|
checkInputs = lib.optionals pythonSupport [
|
|
|
|
pythonPackages.pytest
|
|
|
|
pythonPackages.pytestrunner
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
nettle
|
2020-03-29 10:23:57 +02:00
|
|
|
] ++ lib.optionals pythonSupport [ pythonPackages.python pythonPackages.cffi ]
|
2019-07-31 10:07:19 +02:00
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]
|
|
|
|
;
|
|
|
|
|
|
|
|
makeFlags = [
|
2019-09-03 18:38:57 +02:00
|
|
|
"PREFIX=${placeholder "out"}"
|
2019-07-31 10:07:19 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"build-release"
|
|
|
|
];
|
|
|
|
|
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
|
|
|
|
2020-06-17 12:44:24 +02:00
|
|
|
# Please check if this is still needed when updating.
|
|
|
|
# Exlude tests for sequoia-store, they often error with 'Too many open files' Hydra.
|
|
|
|
CARGO_TEST_ARGS = " --all --exclude sequoia-store";
|
|
|
|
|
2019-07-31 10:07:19 +02:00
|
|
|
postPatch = ''
|
|
|
|
# otherwise, the check fails because we delete the `.git` in the unpack phase
|
|
|
|
substituteInPlace openpgp-ffi/Makefile \
|
|
|
|
--replace 'git grep' 'grep -R'
|
|
|
|
# Without this, the check fails
|
|
|
|
substituteInPlace openpgp-ffi/examples/Makefile \
|
|
|
|
--replace '-O0 -g -Wall -Werror' '-g'
|
|
|
|
substituteInPlace ffi/examples/Makefile \
|
|
|
|
--replace '-O0 -g -Wall -Werror' '-g'
|
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = lib.optionalString pythonSupport ''
|
|
|
|
export installFlags="PYTHONPATH=$PYTHONPATH:$out/${pythonPackages.python.sitePackages}"
|
|
|
|
'' + lib.optionalString (!pythonSupport) ''
|
|
|
|
export installFlags="PYTHON=disable"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Don't use buildRustPackage phases, only use it for rust deps setup
|
|
|
|
configurePhase = null;
|
|
|
|
buildPhase = null;
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = null;
|
|
|
|
installPhase = null;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A cool new OpenPGP implementation";
|
|
|
|
homepage = "https://sequoia-pgp.org/";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ minijackson doronbehar ];
|
2019-11-09 11:13:35 +01:00
|
|
|
broken = stdenv.targetPlatform.isDarwin;
|
2019-07-31 10:07:19 +02:00
|
|
|
};
|
|
|
|
}
|