fix: Flake | use nixfmt=classic to format nix files

This commit is contained in:
2025-02-17 19:24:25 +05:00
parent 234e52f051
commit 7eab398f6d
41 changed files with 189 additions and 370 deletions

View File

@@ -2,12 +2,11 @@
with lib;
let
cfg = config.services.yubikey-touch-detector;
in
{
let cfg = config.services.yubikey-touch-detector;
in {
options.services.yubikey-touch-detector = {
enable = mkEnableOption "a tool to detect when your YubiKey is waiting for a touch";
enable = mkEnableOption
"a tool to detect when your YubiKey is waiting for a touch";
package = mkOption {
type = types.package;
@@ -18,7 +17,8 @@ in
'';
};
socket.enable = mkEnableOption "starting the process only when the socket is used";
socket.enable =
mkEnableOption "starting the process only when the socket is used";
extraArgs = mkOption {
type = types.listOf types.str;
@@ -37,7 +37,8 @@ in
# See https://github.com/maximbaz/yubikey-touch-detector/blob/c9fdff7163361d6323e2de0449026710cacbc08a/LICENSE
# Author: Maxim Baz
systemd.user.sockets.yubikey-touch-detector = mkIf cfg.socket.enable {
Unit.Description = "Unix socket activation for YubiKey touch detector service";
Unit.Description =
"Unix socket activation for YubiKey touch detector service";
Socket = {
ListenFIFO = "%t/yubikey-touch-detector.sock";
RemoveOnStop = true;
@@ -50,15 +51,19 @@ in
systemd.user.services.yubikey-touch-detector = {
Unit = {
Description = "Detects when your YubiKey is waiting for a touch";
Requires = optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
Requires =
optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
};
Service = {
ExecStart = "${cfg.package}/bin/yubikey-touch-detector ${concatStringsSep " " cfg.extraArgs}";
ExecStart = "${cfg.package}/bin/yubikey-touch-detector ${
concatStringsSep " " cfg.extraArgs
}";
Environment = [ "PATH=${lib.makeBinPath [ pkgs.gnupg ]}" ];
Restart = "on-failure";
RestartSec = "1sec";
};
Install.Also = optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
Install.Also =
optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ];
Install.WantedBy = [ "default.target" ];
};
};