depot/third_party/nixpkgs/pkgs/tools/security/yubikey-agent/default.nix
Default email 3a4df29a92 Project import generated by Copybara.
GitOrigin-RevId: 3d7435c638baffaa826b85459df0fff47f12317d
2022-06-16 19:23:12 +02:00

45 lines
1.4 KiB
Nix

{ stdenv, lib, fetchFromGitHub, buildGoModule, libnotify, pcsclite, pkg-config, darwin }:
buildGoModule rec {
pname = "yubikey-agent";
version = "unstable-2022-03-17";
src = fetchFromGitHub {
owner = "FiloSottile";
repo = "yubikey-agent";
rev = "205a7ef2554625c7494038600d963123d6311873";
sha256 = "sha256-wJpN63KY5scmez6yYFsIr3JLEUB+YSl/XvoatIIeRI0=";
};
buildInputs =
lib.optional stdenv.isLinux (lib.getDev pcsclite)
++ lib.optional stdenv.isDarwin (darwin.apple_sdk.frameworks.PCSC);
nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config ];
postPatch = lib.optionalString stdenv.isLinux ''
substituteInPlace main.go --replace 'notify-send' ${libnotify}/bin/notify-send
'';
vendorSha256 = "sha256-SnjbkDPVjAnCbM2nLqBsuaPZwOmvDTKiUbi/93BlWVQ=";
doCheck = false;
subPackages = [ "." ];
ldflags = [ "-s" "-w" "-X main.Version=${version}" ];
postInstall = lib.optionalString stdenv.isLinux ''
mkdir -p $out/lib/systemd/user
substitute contrib/systemd/user/yubikey-agent.service $out/lib/systemd/user/yubikey-agent.service \
--replace 'ExecStart=yubikey-agent' "ExecStart=$out/bin/yubikey-agent"
'';
meta = with lib; {
description = "A seamless ssh-agent for YubiKeys";
license = licenses.bsd3;
homepage = "https://filippo.io/yubikey-agent";
maintainers = with lib.maintainers; [ philandstuff rawkode ];
platforms = platforms.darwin ++ platforms.linux;
};
}