{
  lib,
  rustPlatform,
  fetchFromGitea,
  pkg-config,
  pcsclite,
  dbus,
  openssl,
  testers,
  openpgp-card-ssh-agent,
}:

rustPlatform.buildRustPackage rec {
  pname = "openpgp-card-ssh-agent";
  version = "0.3.4";

  src = fetchFromGitea {
    domain = "codeberg.org";
    owner = "openpgp-card";
    repo = "ssh-agent";
    rev = "v${version}";
    hash = "sha256-nWbvEsVa7YJsBtVZfLQDB4CiaHP3GEYeYS32+WZv8PE=";
  };

  cargoHash = "sha256-nG7xebypXv7UAfu7sWbcp4DIhLv4lfzMrQUY6m2iDmw=";

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    openssl
    pcsclite
    dbus
  ];

  passthru = {
    tests.version = testers.testVersion {
      package = openpgp-card-ssh-agent;
    };
  };

  meta = with lib; {
    description = "An ssh agent that uses OpenPGP cards for your key";
    homepage = "https://codeberg.org/openpgp-card/ssh-agent";
    license = with licenses; [
      asl20 # OR
      mit
    ];
    mainProgram = "openpgp-card-ssh-agent";
  };
}
