at 25.11-pre 1.6 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 inherit (lib) types; 9 cfg = config.programs.yubikey-touch-detector; 10in 11{ 12 options = { 13 programs.yubikey-touch-detector = { 14 15 enable = lib.mkEnableOption "yubikey-touch-detector"; 16 17 libnotify = lib.mkOption { 18 # This used to be true previously and using libnotify would be a sane default. 19 default = true; 20 type = types.bool; 21 description = '' 22 If set to true, yubikey-touch-detctor will send notifications using libnotify 23 ''; 24 }; 25 26 unixSocket = lib.mkOption { 27 default = true; 28 type = types.bool; 29 description = '' 30 If set to true, yubikey-touch-detector will send notifications to a unix socket 31 ''; 32 }; 33 34 verbose = lib.mkOption { 35 default = false; 36 type = types.bool; 37 description = '' 38 Enables verbose logging 39 ''; 40 }; 41 42 }; 43 }; 44 45 config = lib.mkIf cfg.enable { 46 systemd.packages = [ pkgs.yubikey-touch-detector ]; 47 48 systemd.user.services.yubikey-touch-detector = { 49 path = [ pkgs.gnupg ]; 50 51 environment = { 52 YUBIKEY_TOUCH_DETECTOR_LIBNOTIFY = builtins.toString cfg.libnotify; 53 YUBIKEY_TOUCH_DETECTOR_NOSOCKET = builtins.toString (!cfg.unixSocket); 54 YUBIKEY_TOUCH_DETECTOR_VERBOSE = builtins.toString cfg.verbose; 55 }; 56 57 wantedBy = [ "graphical-session.target" ]; 58 partOf = [ "graphical-session.target" ]; 59 }; 60 systemd.user.sockets.yubikey-touch-detector = { 61 wantedBy = [ "sockets.target" ]; 62 }; 63 }; 64}