1 { config, lib, pkgs, ... }:
3 cfg = config.services.logkeys;
5 options.services.logkeys = {
6 enable = lib.mkEnableOption "logkeys, a keylogger service";
8 device = lib.mkOption {
9 description = "Use the given device as keyboard input event device instead of /dev/input/eventX default.";
11 type = lib.types.nullOr lib.types.str;
12 example = "/dev/input/event15";
16 config = lib.mkIf cfg.enable {
17 systemd.services.logkeys = {
18 description = "LogKeys Keylogger Daemon";
19 wantedBy = [ "multi-user.target" ];
21 ExecStart = "${pkgs.logkeys}/bin/logkeys -s${lib.optionalString (cfg.device != null) " -d ${cfg.device}"}";
22 ExecStop = "${pkgs.logkeys}/bin/logkeys -k";