nixpkgs/pkgs/by-name/op/openpgp-card-tools/package.nix
Robin Krahl 5db8bf44de
openpgp-card-tools: Add shell completions and man pages
This patch adds a postInstall step to generate and install shell
completions and man pages as described in the project readme:
https://codeberg.org/openpgp-card/openpgp-card-tools/src/tag/v0.11.7#system-integration
2024-11-08 21:12:29 +01:00

56 lines
1.4 KiB
Nix

{ lib
, stdenv
, rustPlatform
, fetchFromGitea
, installShellFiles
, pkg-config
, pcsclite
, dbus
, testers
, openpgp-card-tools
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "openpgp-card-tools";
version = "0.11.7";
src = fetchFromGitea {
domain = "codeberg.org";
owner = "openpgp-card";
repo = "openpgp-card-tools";
rev = "v${version}";
hash = "sha256-sR+jBCSuDH4YdJz3YuvA4EE36RHV3m/xU8hIEXXsqKo=";
};
cargoHash = "sha256-G5+lVK41hbzy/Ltc0EKoUfqF0M1OYu679jyVjYKJmn0=";
nativeBuildInputs = [ installShellFiles pkg-config rustPlatform.bindgenHook ];
buildInputs = [ pcsclite dbus ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.PCSC
darwin.apple_sdk.frameworks.Security
];
passthru = {
tests.version = testers.testVersion {
package = openpgp-card-tools;
};
};
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
OCT_COMPLETION_OUTPUT_DIR=$PWD/shell $out/bin/oct
installShellCompletion ./shell/oct.{bash,fish} ./shell/_oct
OCT_MANPAGE_OUTPUT_DIR=$PWD/man $out/bin/oct
installManPage ./man/*.1
'';
meta = with lib; {
description = "Tool for inspecting and configuring OpenPGP cards";
homepage = "https://codeberg.org/openpgp-card/openpgp-card-tools";
license = with licenses ;[ asl20 /* OR */ mit ];
maintainers = with maintainers; [ nickcao ];
mainProgram = "oct";
};
}