1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
{
lib,
stdenv,
rustPlatform,
fetchFromGitLab,
installShellFiles,
pkg-config,
nettle,
openssl,
sqlite,
darwin,
gnupg,
}:
rustPlatform.buildRustPackage rec {
pname = "sequoia-wot";
version = "0.11.0";
src = fetchFromGitLab {
owner = "sequoia-pgp";
repo = "sequoia-wot";
rev = "v${version}";
hash = "sha256-qSf2uESsMGUEvAiRefpwxHKyizbq5Sst3SpjKaMIWTQ=";
};
cargoHash = "sha256-vGseKdHqyncScS57UF3SR3EVdUGKVMue8fnRftefSY0=";
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
installShellFiles
];
buildInputs = [
openssl
sqlite
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
# See comment near sequoia-openpgp/crypto- buildFeatures
] ++ lib.optionals (!stdenv.targetPlatform.isWindows) [
nettle
];
buildFeatures = [
# Upstream uses the sequoia-openpgp crate, which doesn't force you to use a
# specific crypto backend. As recommended by sequoia-openpgp's crate
# docs[1], upstream uses `target.'cfg(not(windows))'.dev-dependencies` to
# choose a different backend when the target platform is Windows or not. We
# propagate this logic here as well.
#
# [1]: https://crates.io/crates/sequoia-openpgp#user-content-intermediate-crate
(if stdenv.targetPlatform.isWindows then
"sequoia-openpgp/crypto-cng"
else
"sequoia-openpgp/crypto-nettle"
)
];
doCheck = true;
nativeCheckInputs = [ gnupg ];
# Install shell completion files and manual pages. Unfortunatly it is hard to
# predict the paths to all of these files generated during the build, and it
# is impossible to control these using `$OUT_DIR` or alike, as implied by
# upstream's `build.rs`. This is a general Rust issue also discussed in
# https://github.com/rust-lang/cargo/issues/9661, also discussed upstream at:
# https://gitlab.com/sequoia-pgp/sequoia-wot/-/issues/56
postInstall = ''
installShellCompletion --cmd sq-wot \
--bash target/*/release/build/sequoia-wot-*/out/sq-wot.bash \
--fish target/*/release/build/sequoia-wot-*/out/sq-wot.fish \
--zsh target/*/release/build/sequoia-wot-*/out/_sq-wot
# Also elv and powershell are generated there
installManPage \
target/*/release/build/sequoia-wot-*/out/sq-wot.1 \
target/*/release/build/sequoia-wot-*/out/sq-wot-authenticate.1 \
target/*/release/build/sequoia-wot-*/out/sq-wot-lookup.1 \
target/*/release/build/sequoia-wot-*/out/sq-wot-identify.1 \
target/*/release/build/sequoia-wot-*/out/sq-wot-list.1 \
target/*/release/build/sequoia-wot-*/out/sq-wot-path.1
'';
meta = with lib; {
description = "Rust CLI tool for authenticating bindings and exploring a web of trust";
homepage = "https://gitlab.com/sequoia-pgp/sequoia-wot";
license = licenses.gpl2Only;
maintainers = with maintainers; [ Cryolitia ];
mainProgram = "sq-wot";
};
}
|