2017-12-23 00:08:05 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2017-04-25 23:53:50 +01:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.logkeys;
|
|
|
|
in {
|
|
|
|
options.services.logkeys = {
|
|
|
|
enable = mkEnableOption "logkeys service";
|
2018-02-21 07:11:33 +00:00
|
|
|
|
|
|
|
device = mkOption {
|
|
|
|
description = "Use the given device as keyboard input event device instead of /dev/input/eventX default.";
|
|
|
|
default = null;
|
2019-08-08 21:48:27 +01:00
|
|
|
type = types.nullOr types.str;
|
2018-02-21 07:11:33 +00:00
|
|
|
example = "/dev/input/event15";
|
|
|
|
};
|
2017-04-25 23:53:50 +01: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 23:53:50 +01:00
|
|
|
ExecStop = "${pkgs.logkeys}/bin/logkeys -k";
|
|
|
|
Type = "forking";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|