{
  lib,
  rustPlatform,
  fetchFromGitea,
  pkg-config,
  pcsclite,
  dbus,
  openssl,
  sqlite,
  testers,
  openpgp-card-tool-git,
}:

rustPlatform.buildRustPackage rec {
  pname = "openpgp-card-tool-git";
  version = "0.1.6";

  src = fetchFromGitea {
    domain = "codeberg.org";
    owner = "openpgp-card";
    repo = "oct-git";
    rev = "v${version}";
    hash = "sha256-38/JHzCkL3+0IbOacH54A5Hj03oDe9jDzcwp672a8LE=";
  };

  cargoHash = "sha256-j1Osj2rjLxrSKh82ym6PiIHVO1wLE7Ax2/5+pdRcv+E=";

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    openssl
    pcsclite
    dbus
    sqlite
  ];

  passthru = {
    tests.version = testers.testVersion {
      package = openpgp-card-tool-git;
    };
  };

  meta = with lib; {
    description = "Tool for using OpenPGP cards with git";
    homepage = "https://codeberg.org/openpgp-card/oct-git";
    license = with licenses; [
      asl20 # OR
      mit
    ];
    mainProgram = "oct-git";
  };
}
