41 lines
1.2 KiB
Nix
41 lines
1.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.ptw.services.input-remapper;
|
|
in {
|
|
options.ptw.services.input-remapper = {
|
|
enable = lib.mkEnableOption "Enable the input-remapper service and install it";
|
|
postStartCommand = lib.mkOption {
|
|
default = "";
|
|
description = "Command to be executed after the input-remapper service has been started";
|
|
# type = ;
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# TODO: Assert that uinput is in kernelModules
|
|
services.udev = {
|
|
packages = with pkgs; [ input-remapper ];
|
|
extraRules = ''
|
|
KERNEL=="uinput", GROUP="input", MODE="0660"
|
|
'';
|
|
};
|
|
|
|
environment.systemPackages = [
|
|
pkgs.input-remapper # Custom package
|
|
];
|
|
|
|
systemd.user.services.input-remapper = {
|
|
description = "A tool to change the mapping of your input device buttons";
|
|
wantedBy = [ "default.target" ];
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
ExecStart = "${pkgs.input-remapper}/bin/input-remapper-service";
|
|
Restart = "always";
|
|
# NOTE: The Tartarus may not be connected, so don't fail if we cannot set the preset
|
|
ExecStartPost = cfg.postStartCommand;
|
|
};
|
|
};
|
|
};
|
|
}
|