1 { config, lib, pkgs, ... }:
3 format = pkgs.formats.yaml { };
4 cfg = config.services.evdevremapkeys;
8 options.services.evdevremapkeys = {
9 enable = lib.mkEnableOption ''evdevremapkeys, a daemon to remap events on linux input devices'';
11 settings = lib.mkOption {
15 config.yaml for evdevremapkeys
20 config = lib.mkIf cfg.enable {
21 boot.kernelModules = [ "uinput" ];
22 services.udev.extraRules = ''
23 KERNEL=="uinput", MODE="0660", GROUP="input"
25 users.groups.evdevremapkeys = { };
26 users.users.evdevremapkeys = {
27 description = "evdevremapkeys service user";
28 group = "evdevremapkeys";
29 extraGroups = [ "input" ];
32 systemd.services.evdevremapkeys = {
33 description = "evdevremapkeys";
34 wantedBy = [ "multi-user.target" ];
37 config = format.generate "config.yaml" cfg.settings;
40 ExecStart = "${pkgs.evdevremapkeys}/bin/evdevremapkeys --config-file ${config}";
41 User = "evdevremapkeys";
42 Group = "evdevremapkeys";
43 StateDirectory = "evdevremapkeys";
45 LockPersonality = true;
46 MemoryDenyWriteExecute = true;
47 NoNewPrivileges = true;
48 PrivateNetwork = true;
50 ProtectControlGroups = true;
52 ProtectKernelTunables = true;