nixos-configuration/home-manager/modules/sway/yubikey-touch-detector.nix
2022-04-27 11:02:19 +00:00

31 lines
886 B
Nix

{ nixosConfig, config, lib, pkgs, ... }:
{
systemd.user.services.yubikey-touch-detector = {
Unit = {
PartOf = [ "sway-session.target" ];
Description = "Detects when your YubiKey is waiting for a touch";
Requires = "yubikey-touch-detector.socket";
};
Install = {
WantedBy = [ "sway-session.target" ];
Also = "yubikey-touch-detector.socket";
};
Service = {
Environment = "YUBIKEY_TOUCH_DETECTOR_LIBNOTIFY=true";
ExecStart = "${pkgs.yubikey-touch-detector}/bin/yubikey-touch-detector";
Restart = "on-failure";
};
};
systemd.user.sockets.yubikey-touch-detector = {
Unit.Description = "Unix socket activation for YubiKey touch detector service";
Socket = {
ListenStream = "%t/yubikey-touch-detector.socket";
RemoveOnStop = "yes";
};
Install.WantedBy = [ "sockets.target" ];
};
}