4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
107 lines
2.5 KiB
Nix
107 lines
2.5 KiB
Nix
{ 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
|
|
}:
|
|
|
|
assert pythonSupport -> pythonPackages != null;
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "sequoia";
|
|
version = "1.0.0";
|
|
|
|
src = fetchFromGitLab {
|
|
owner = "sequoia-pgp";
|
|
repo = "sequoia";
|
|
rev = "v${version}";
|
|
sha256 = "0y80bl786m29ww3272qsl1ql0xc3pwd6iiqlkv3nmhnjsmygbn0d";
|
|
};
|
|
|
|
cargoSha256 = "03ngywa5z0c7qmdmhynk13xcivhg8gpivvpzg2gxp34gfr7j438l";
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
cargo
|
|
rustc
|
|
git
|
|
llvmPackages_10.libclang
|
|
llvmPackages_10.clang
|
|
ensureNewerSourcesForZipFilesHook
|
|
capnproto
|
|
] ++
|
|
lib.optionals pythonSupport [ pythonPackages.setuptools ]
|
|
;
|
|
|
|
checkInputs = lib.optionals pythonSupport [
|
|
pythonPackages.pytest
|
|
pythonPackages.pytestrunner
|
|
];
|
|
|
|
buildInputs = [
|
|
openssl
|
|
sqlite
|
|
nettle
|
|
] ++ lib.optionals pythonSupport [ pythonPackages.python pythonPackages.cffi ]
|
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]
|
|
;
|
|
|
|
makeFlags = [
|
|
"PREFIX=${placeholder "out"}"
|
|
# Defaults to "ginstall" from some reason, although upstream's Makefiles check uname
|
|
"INSTALL=install"
|
|
];
|
|
|
|
buildFlags = [
|
|
"build-release"
|
|
];
|
|
|
|
LIBCLANG_PATH = "${llvmPackages_10.libclang}/lib";
|
|
|
|
# Sometimes, tests fail on CI (ofborg) & hydra without this
|
|
CARGO_TEST_ARGS = "--workspace --exclude sequoia-store";
|
|
|
|
# Without this, the examples won't build
|
|
postPatch = ''
|
|
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 makeFlags="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 lib; {
|
|
description = "A cool new OpenPGP implementation";
|
|
homepage = "https://sequoia-pgp.org/";
|
|
license = licenses.gpl3;
|
|
maintainers = with maintainers; [ minijackson doronbehar ];
|
|
};
|
|
}
|