2020-08-14 18:26:05 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitLab
|
|
|
|
, lib
|
|
|
|
, darwin
|
|
|
|
, git
|
|
|
|
, nettle
|
|
|
|
# Use the same llvmPackages version as Rust
|
|
|
|
, llvmPackages_10
|
|
|
|
, cargo
|
|
|
|
, rustc
|
|
|
|
, rustPlatform
|
|
|
|
, pkg-config
|
|
|
|
, glib
|
|
|
|
, openssl
|
|
|
|
, sqlite
|
|
|
|
, capnproto
|
|
|
|
, ensureNewerSourcesForZipFilesHook
|
|
|
|
, pythonSupport ? true
|
|
|
|
, pythonPackages ? null
|
2019-07-31 09:07:19 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert pythonSupport -> pythonPackages != null;
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "sequoia";
|
2020-08-14 18:26:05 +01:00
|
|
|
version = "0.19.0";
|
2019-07-31 09:07:19 +01:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "sequoia-pgp";
|
2020-08-14 18:26:05 +01:00
|
|
|
repo = "sequoia";
|
2019-07-31 09:07:19 +01:00
|
|
|
rev = "v${version}";
|
2020-08-14 18:26:05 +01:00
|
|
|
sha256 = "1870wd03c3x0da9p3jmkvfx8am87ak0dcsvp2qkjvglbl396kd8y";
|
2019-07-31 09:07:19 +01:00
|
|
|
};
|
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
cargoSha256 = "0bb51vdppdjhsxbfy3lyqvw5r5j58r3wi0qb68m2a45k3za7liss";
|
2019-07-31 09:07:19 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2020-08-14 18:26:05 +01:00
|
|
|
pkg-config
|
2019-07-31 09:07:19 +01:00
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
git
|
2020-08-14 18:26:05 +01:00
|
|
|
llvmPackages_10.libclang
|
|
|
|
llvmPackages_10.clang
|
2019-07-31 09:07:19 +01:00
|
|
|
ensureNewerSourcesForZipFilesHook
|
2020-03-29 09:23:57 +01:00
|
|
|
capnproto
|
2019-07-31 09:07:19 +01:00
|
|
|
] ++
|
|
|
|
lib.optionals pythonSupport [ pythonPackages.setuptools ]
|
|
|
|
;
|
|
|
|
|
|
|
|
checkInputs = lib.optionals pythonSupport [
|
|
|
|
pythonPackages.pytest
|
|
|
|
pythonPackages.pytestrunner
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
nettle
|
2020-03-29 09:23:57 +01:00
|
|
|
] ++ lib.optionals pythonSupport [ pythonPackages.python pythonPackages.cffi ]
|
2019-07-31 09:07:19 +01:00
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]
|
|
|
|
;
|
|
|
|
|
|
|
|
makeFlags = [
|
2019-09-03 17:38:57 +01:00
|
|
|
"PREFIX=${placeholder "out"}"
|
2019-07-31 09:07:19 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"build-release"
|
|
|
|
];
|
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
LIBCLANG_PATH = "${llvmPackages_10.libclang}/lib";
|
2019-07-31 09:07:19 +01:00
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
# Sometimes, tests fail on CI (ofborg) & hydra without this
|
|
|
|
CARGO_TEST_ARGS = "--workspace --exclude sequoia-store";
|
2020-06-17 11:44:24 +01:00
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
# Without this, the examples won't build
|
2019-07-31 09:07:19 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace openpgp-ffi/examples/Makefile \
|
|
|
|
--replace '-O0 -g -Wall -Werror' '-g'
|
|
|
|
substituteInPlace ffi/examples/Makefile \
|
|
|
|
--replace '-O0 -g -Wall -Werror' '-g'
|
|
|
|
'';
|
|
|
|
|
2020-08-14 18:26:05 +01:00
|
|
|
|
2019-07-31 09:07:19 +01:00
|
|
|
preInstall = lib.optionalString pythonSupport ''
|
|
|
|
export installFlags="PYTHONPATH=$PYTHONPATH:$out/${pythonPackages.python.sitePackages}"
|
|
|
|
'' + lib.optionalString (!pythonSupport) ''
|
2020-08-14 18:26:05 +01:00
|
|
|
export makeFlags="PYTHON=disable"
|
2019-07-31 09:07:19 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# 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 10:13:35 +00:00
|
|
|
broken = stdenv.targetPlatform.isDarwin;
|
2019-07-31 09:07:19 +01:00
|
|
|
};
|
|
|
|
}
|