summary refs log tree commit diff
path: root/nixos/modules/services/misc/input-remapper.nix
blob: f5fb2bf53086f1ad6bbe4016530259d22a8f516a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ pkgs, lib, config, ... }:

with lib;

let cfg = config.services.input-remapper; in
{
  options = {
    services.input-remapper = {
      enable = mkEnableOption "input-remapper, an easy to use tool to change the mapping of your input device buttons.";
      package = options.mkPackageOption pkgs "input-remapper" { };
      enableUdevRules = mkEnableOption "udev rules added by input-remapper to handle hotplugged devices. Currently disabled by default due to https://github.com/sezanzeb/input-remapper/issues/140";
      serviceWantedBy = mkOption {
        default = [ "graphical.target" ];
        example = [ "multi-user.target" ];
        type = types.listOf types.str;
        description = "Specifies the WantedBy setting for the input-remapper service.";
      };
    };
  };

  config = mkIf cfg.enable {
    services.udev.packages = mkIf cfg.enableUdevRules [ cfg.package ];
    services.dbus.packages = [ cfg.package ];
    systemd.packages = [ cfg.package ];
    environment.systemPackages = [ cfg.package ];
    systemd.services.input-remapper.wantedBy = cfg.serviceWantedBy;
  };

  meta.maintainers = with lib.maintainers; [ LunNova ];
}