2017-12-23 00:08:05 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2017-04-25 22:53:50 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.logkeys;
|
|
|
|
in {
|
|
|
|
options.services.logkeys = {
|
2022-08-28 19:18:44 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "logkeys service");
|
2018-02-21 07:11:33 +00:00
|
|
|
|
|
|
|
device = mkOption {
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc "Use the given device as keyboard input event device instead of /dev/input/eventX default.";
|
2018-02-21 07:11:33 +00:00
|
|
|
default = null;
|
2019-08-08 20:48:27 +00:00
|
|
|
type = types.nullOr types.str;
|
2018-02-21 07:11:33 +00:00
|
|
|
example = "/dev/input/event15";
|
|
|
|
};
|
2017-04-25 22:53:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.logkeys = {
|
|
|
|
description = "LogKeys Keylogger Daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
2018-02-21 07:11:33 +00:00
|
|
|
ExecStart = "${pkgs.logkeys}/bin/logkeys -s${lib.optionalString (cfg.device != null) " -d ${cfg.device}"}";
|
2017-04-25 22:53:50 +00:00
|
|
|
ExecStop = "${pkgs.logkeys}/bin/logkeys -k";
|
|
|
|
Type = "forking";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|