nixpkgs/pkgs/tools/security/yubikey-agent/default.nix
Benjamin Bädorf 4995a873a7
yubikey-agent: 0.1.5 -> unstable-2022-03-17
`yubikey-agent` is updated to a newer commit. It hasn't received an
official release in a while which is why the update is to an "unstable"
version.

Closes https://github.com/NixOS/nixpkgs/issues/145392

Co-authored-by: teutat3s <10206665+teutat3s@users.noreply.github.com>
Co-authored-by: hensoko <hensoko@gssws.de>
2022-06-04 21:51:26 +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;
};
}