1 { config, lib, pkgs, ... }:
6 cfg = config.services.interception-tools;
8 options.services.interception-tools = {
12 description = lib.mdDoc "Whether to enable the interception tools service.";
16 type = types.listOf types.package;
17 default = [ pkgs.interception-tools-plugins.caps2esc ];
18 defaultText = literalExpression "[ pkgs.interception-tools-plugins.caps2esc ]";
19 description = lib.mdDoc ''
20 A list of interception tools plugins that will be made available to use
21 inside the udevmon configuration.
25 udevmonConfig = mkOption {
26 type = types.either types.str types.path;
28 - JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
31 EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
34 - JOB: "intercept -g $DEVNODE | y2z | x2y | uinput -d $DEVNODE"
37 EV_KEY: [KEY_X, KEY_Y]
39 description = lib.mdDoc ''
40 String of udevmon YAML configuration, or path to a udevmon YAML
46 config = mkIf cfg.enable {
47 systemd.services.interception-tools = {
48 description = "Interception tools";
49 path = [ pkgs.bash pkgs.interception-tools ] ++ cfg.plugins;
52 ${pkgs.interception-tools}/bin/udevmon -c \
53 ${if builtins.typeOf cfg.udevmonConfig == "path"
54 then cfg.udevmonConfig
55 else pkgs.writeText "udevmon.yaml" cfg.udevmonConfig}
59 wantedBy = [ "multi-user.target" ];