input-remapper: Rename from key-mapper
This commit is contained in:
40
modules/services/input-remapper/default.nix
Normal file
40
modules/services/input-remapper/default.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user