mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-16 09:54:52 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
91 lines
2.9 KiB
Nix
91 lines
2.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
rustPlatform,
|
|
fetchFromGitLab,
|
|
installShellFiles,
|
|
pkg-config,
|
|
nettle,
|
|
openssl,
|
|
sqlite,
|
|
darwin,
|
|
gnupg,
|
|
}:
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "sequoia-wot";
|
|
version = "0.12.0";
|
|
|
|
src = fetchFromGitLab {
|
|
owner = "sequoia-pgp";
|
|
repo = "sequoia-wot";
|
|
rev = "v${version}";
|
|
hash = "sha256-Xbj1XLZQxyEYf/+R5e6EJMmL0C5ohfwZMZPVK5PwmUU=";
|
|
};
|
|
|
|
cargoHash = "sha256-BidSKnsIEEEU8UarbhqALcp44L0pes6O4m2mSEL1r4Q=";
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
rustPlatform.bindgenHook
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs = [
|
|
openssl
|
|
sqlite
|
|
] ++ lib.optionals stdenv.hostPlatform.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 = {
|
|
description = "Rust CLI tool for authenticating bindings and exploring a web of trust";
|
|
homepage = "https://gitlab.com/sequoia-pgp/sequoia-wot";
|
|
license = lib.licenses.gpl2Only;
|
|
maintainers = with lib.maintainers; [ doronbehar Cryolitia ];
|
|
mainProgram = "sq-wot";
|
|
};
|
|
}
|