2021-02-05 17:12:51 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, buildGoModule, libnotify, makeWrapper, pcsclite, pinentry_mac, pkg-config, darwin }:
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "yubikey-agent";
|
2021-07-14 22:03:04 +00:00
|
|
|
version = "0.1.4";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "FiloSottile";
|
|
|
|
repo = pname;
|
2021-07-14 22:03:04 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1b4522s7xkh6q74m0lprbnzg2hspg1pr9rzn94qmd06sry82d3fd";
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
lib.optional stdenv.isLinux (lib.getDev pcsclite)
|
|
|
|
++ lib.optional stdenv.isDarwin (darwin.apple_sdk.frameworks.PCSC);
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper pkg-config ];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
postPatch = lib.optionalString stdenv.isLinux ''
|
|
|
|
substituteInPlace main.go --replace 'notify-send' ${libnotify}/bin/notify-send
|
|
|
|
'';
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
vendorSha256 = "0cpj4nj2g0ick6p79h4pnjg7ybnyz9p26jivv0awi6bmn378nbxn";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
|
|
|
# On macOS, there isn't a choice of pinentry program, so let's
|
|
|
|
# ensure the nixpkgs-provided one is available
|
|
|
|
postInstall = lib.optionalString stdenv.isDarwin ''
|
|
|
|
wrapProgram $out/bin/yubikey-agent --suffix PATH : $(dirname ${pinentry_mac}/${pinentry_mac.binaryPath})
|
2021-07-14 22:03:04 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2020-08-20 17:08:02 +00:00
|
|
|
mkdir -p $out/lib/systemd/user
|
2021-04-17 00:35:05 +00:00
|
|
|
substitute contrib/systemd/user/yubikey-agent.service $out/lib/systemd/user/yubikey-agent.service \
|
2020-08-20 17:08:02 +00:00
|
|
|
--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;
|
|
|
|
};
|
|
|
|
}
|