2024-12-10 20:26:33 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2017-04-26 00:53:50 +02:00
|
|
|
let
|
|
|
|
cfg = config.services.logkeys;
|
2024-12-10 20:26:33 +01:00
|
|
|
in
|
|
|
|
{
|
2017-04-26 00:53:50 +02:00
|
|
|
options.services.logkeys = {
|
2024-08-24 22:05:47 +02:00
|
|
|
enable = lib.mkEnableOption "logkeys, a keylogger service";
|
2018-02-21 08:11:33 +01:00
|
|
|
|
2024-08-24 22:05:47 +02:00
|
|
|
device = lib.mkOption {
|
2024-04-13 14:54:15 +02:00
|
|
|
description = "Use the given device as keyboard input event device instead of /dev/input/eventX default.";
|
2018-02-21 08:11:33 +01:00
|
|
|
default = null;
|
2024-08-24 22:05:47 +02:00
|
|
|
type = lib.types.nullOr lib.types.str;
|
2018-02-21 08:11:33 +01:00
|
|
|
example = "/dev/input/event15";
|
|
|
|
};
|
2017-04-26 00:53:50 +02:00
|
|
|
};
|
|
|
|
|
2024-08-24 22:05:47 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
2017-04-26 00:53:50 +02:00
|
|
|
systemd.services.logkeys = {
|
|
|
|
description = "LogKeys Keylogger Daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
2024-12-10 20:26:33 +01:00
|
|
|
ExecStart = "${pkgs.logkeys}/bin/logkeys -s${
|
|
|
|
lib.optionalString (cfg.device != null) " -d ${cfg.device}"
|
|
|
|
}";
|
2017-04-26 00:53:50 +02:00
|
|
|
ExecStop = "${pkgs.logkeys}/bin/logkeys -k";
|
|
|
|
Type = "forking";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|