nixos-config/modules/services/logiops/default.nix

43 lines
1007 B
Nix

{ lib, pkgs, config, ... }:
let
cfg = config.ptw.services.logiops;
in {
options.ptw.services.logiops = {
enable = lib.mkEnableOption "Enable logiops";
renice = lib.mkOption {
description = "Set the nice value of the process";
default = true;
};
reniceValue = lib.mkOption {
description = "Set the nice value of the process";
default = -19;
};
};
config = lib.mkIf true {
environment.etc."logid.cfg".text = ''
devices: (
{
name: "Wireless Mouse MX Master 3";
hiresscroll: {
hires: true;
};
dpi: 800;
}
);
'';
systemd.services.logiops = {
description = "An unofficial userspace driver for HID++ Logitech devices";
wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = let
renice = lib.optionalString cfg.renice "${pkgs.coreutils-full}/bin/nice -n ${builtins.toString cfg.reniceValue}";
in "${renice} ${pkgs.logiops}/bin/logid";
};
};
};
}