From ee6fa1027f98496a6d38024d0f0f3fbde4ca6799 Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Tue, 27 Aug 2024 20:44:00 +0200 Subject: [PATCH] programs/yubikey-touch-detector: expose configuration variables commit 9b4abd6546fb87ab9fac4f2d77598417c6a17803 removed opionated configuration from the `yubikey-touch-detector` package. This adds configuration options for the service into the program configuraion. --- .../programs/yubikey-touch-detector.nix | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/nixos/modules/programs/yubikey-touch-detector.nix b/nixos/modules/programs/yubikey-touch-detector.nix index 9a0d107f73c9..42beabbc4e94 100644 --- a/nixos/modules/programs/yubikey-touch-detector.nix +++ b/nixos/modules/programs/yubikey-touch-detector.nix @@ -1,9 +1,44 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.yubikey-touch-detector; -in { +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) types; + cfg = config.programs.yubikey-touch-detector; +in +{ options = { programs.yubikey-touch-detector = { + enable = lib.mkEnableOption "yubikey-touch-detector"; + + libnotify = lib.mkOption { + # This used to be true previously and using libnotify would be a sane default. + default = true; + type = types.bool; + description = '' + If set to true, yubikey-touch-detctor will send notifications using libnotify + ''; + }; + + unixSocket = lib.mkOption { + default = true; + type = types.bool; + description = '' + If set to true, yubikey-touch-detector will send notifications to a unix socket + ''; + }; + + verbose = lib.mkOption { + default = false; + type = types.bool; + description = '' + Enables verbose logging + ''; + }; + }; }; @@ -12,6 +47,13 @@ in { systemd.user.services.yubikey-touch-detector = { path = [ pkgs.gnupg ]; + + environment = { + YUBIKEY_TOUCH_DETECTOR_LIBNOTIFY = builtins.toString cfg.libnotify; + YUBIKEY_TOUCH_DETECTOR_NOSOCKET = builtins.toString (!cfg.unixSocket); + YUBIKEY_TOUCH_DETECTOR_VERBOSE = builtins.toString cfg.verbose; + }; + wantedBy = [ "graphical-session.target" ]; }; systemd.user.sockets.yubikey-touch-detector = {