1 { config, lib, pkgs, ... }:
3 cfg = config.services.interception-tools;
5 options.services.interception-tools = {
6 enable = lib.mkOption {
9 description = "Whether to enable the interception tools service.";
12 plugins = lib.mkOption {
13 type = lib.types.listOf lib.types.package;
14 default = [ pkgs.interception-tools-plugins.caps2esc ];
15 defaultText = lib.literalExpression "[ pkgs.interception-tools-plugins.caps2esc ]";
17 A list of interception tools plugins that will be made available to use
18 inside the udevmon configuration.
22 udevmonConfig = lib.mkOption {
23 type = lib.types.either lib.types.str lib.types.path;
25 - JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
28 EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
31 - JOB: "intercept -g $DEVNODE | y2z | x2y | uinput -d $DEVNODE"
34 EV_KEY: [KEY_X, KEY_Y]
37 String of udevmon YAML configuration, or path to a udevmon YAML
43 config = lib.mkIf cfg.enable {
44 systemd.services.interception-tools = {
45 description = "Interception tools";
46 path = [ pkgs.bash pkgs.interception-tools ] ++ cfg.plugins;
49 ${pkgs.interception-tools}/bin/udevmon -c \
50 ${if builtins.typeOf cfg.udevmonConfig == "path"
51 then cfg.udevmonConfig
52 else pkgs.writeText "udevmon.yaml" cfg.udevmonConfig}
56 wantedBy = [ "multi-user.target" ];