2020-09-25 04:45:31 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitLab
|
2022-10-30 15:09:59 +00:00
|
|
|
, fetchpatch
|
2020-09-25 04:45:31 +00:00
|
|
|
, lib
|
|
|
|
, darwin
|
|
|
|
, git
|
|
|
|
, nettle
|
|
|
|
# Use the same llvmPackages version as Rust
|
2022-03-30 09:31:56 +00:00
|
|
|
, llvmPackages_12
|
2020-09-25 04:45:31 +00:00
|
|
|
, cargo
|
|
|
|
, rustc
|
|
|
|
, rustPlatform
|
|
|
|
, pkg-config
|
|
|
|
, glib
|
|
|
|
, openssl
|
|
|
|
, sqlite
|
|
|
|
, capnproto
|
|
|
|
, ensureNewerSourcesForZipFilesHook
|
|
|
|
, pythonSupport ? true
|
|
|
|
, pythonPackages ? null
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert pythonSupport -> pythonPackages != null;
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "sequoia";
|
2021-02-13 14:23:35 +00:00
|
|
|
# Upstream has separate version numbering for the library and the CLI frontend.
|
|
|
|
# This derivation provides the CLI frontend, and thus uses its version number.
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "0.27.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "sequoia-pgp";
|
2020-09-25 04:45:31 +00:00
|
|
|
repo = "sequoia";
|
2021-02-13 14:23:35 +00:00
|
|
|
rev = "sq/v${version}";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-KhJAXpj47Tvds5SLYwnsNeIlPf9QEopoCzsvvHgCwaI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
cargoSha256 = "sha256-Y7iiZVIT9Vbe4YmTfGTU8p3H3odQKms2FBnnWgvF7mI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch
|
|
|
|
{ url = "https://gitlab.com/sequoia-pgp/sequoia/-/commit/7916f90421ecb9a75e32f0284459bcc9a3fd02b0.patch";
|
|
|
|
sha256 = "sha256-KBBn6XaGzIT0iVzoCYsS0N+OkZzGuWmUmIF2hl49FEI=";
|
|
|
|
}
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
2020-09-25 04:45:31 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
git
|
2022-03-30 09:31:56 +00:00
|
|
|
llvmPackages_12.libclang.lib
|
|
|
|
llvmPackages_12.clang
|
2020-04-24 23:36:52 +00:00
|
|
|
ensureNewerSourcesForZipFilesHook
|
|
|
|
capnproto
|
|
|
|
] ++
|
|
|
|
lib.optionals pythonSupport [ pythonPackages.setuptools ]
|
|
|
|
;
|
|
|
|
|
|
|
|
checkInputs = lib.optionals pythonSupport [
|
|
|
|
pythonPackages.pytest
|
2021-07-24 12:14:16 +00:00
|
|
|
pythonPackages.pytest-runner
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
nettle
|
|
|
|
] ++ lib.optionals pythonSupport [ pythonPackages.python pythonPackages.cffi ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]
|
|
|
|
;
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${placeholder "out"}"
|
2020-11-03 02:18:15 +00:00
|
|
|
# Defaults to "ginstall" from some reason, although upstream's Makefiles check uname
|
|
|
|
"INSTALL=install"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"build-release"
|
|
|
|
];
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
LIBCLANG_PATH = "${llvmPackages_12.libclang.lib}/lib";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
# Sometimes, tests fail on CI (ofborg) & hydra without this
|
2022-08-12 12:06:08 +00:00
|
|
|
checkFlags = [
|
|
|
|
# doctest for sequoia-ipc fail for some reason
|
|
|
|
"--skip=macros::assert_send_and_sync"
|
|
|
|
"--skip=macros::time_it"
|
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preInstall = lib.optionalString pythonSupport ''
|
|
|
|
export installFlags="PYTHONPATH=$PYTHONPATH:$out/${pythonPackages.python.sitePackages}"
|
|
|
|
'' + lib.optionalString (!pythonSupport) ''
|
2020-09-25 04:45:31 +00:00
|
|
|
export makeFlags="PYTHON=disable"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Don't use buildRustPackage phases, only use it for rust deps setup
|
|
|
|
configurePhase = null;
|
|
|
|
buildPhase = null;
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = null;
|
|
|
|
installPhase = null;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A cool new OpenPGP implementation";
|
|
|
|
homepage = "https://sequoia-pgp.org/";
|
2021-09-18 10:52:07 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ minijackson doronbehar ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "sq";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|