nixos/evdevremapkeys: init

Add a service for evdevremapkeys (already packaged), a daemon for
remapping keyboard events
This commit is contained in:
Evan Goode 2023-02-07 22:59:36 -05:00
parent c77cd042e3
commit be333da51f
3 changed files with 62 additions and 0 deletions

View file

@ -83,6 +83,8 @@ In addition to numerous new and updated packages, this release has the following
- [gitea-actions-runner](https://gitea.com/gitea/act_runner), a CI runner for Gitea/Forgejo Actions. Available as [services.gitea-actions-runner](#opt-services.gitea-actions-runner.instances).
- [evdevremapkeys](https://github.com/philipl/evdevremapkeys), a daemon to remap key events. Available as [services.evdevremapkeys](#opt-services.evdevremapkeys.enable).
- [gmediarender](https://github.com/hzeller/gmrender-resurrect), a simple, headless UPnP/DLNA renderer. Available as [services.gmediarender](options.html#opt-services.gmediarender.enable).
- [go2rtc](https://github.com/AlexxIT/go2rtc), a camera streaming appliation with support for RTSP, WebRTC, HomeKit, FFMPEG, RTMP and other protocols. Available as [services.go2rtc](options.html#opt-services.go2rtc.enable).

View file

@ -633,6 +633,7 @@
./services/misc/etcd.nix
./services/misc/etebase-server.nix
./services/misc/etesync-dav.nix
./services/misc/evdevremapkeys.nix
./services/misc/felix.nix
./services/misc/freeswitch.nix
./services/misc/fstrim.nix

View file

@ -0,0 +1,59 @@
{ config, lib, pkgs, ... }:
with lib;
let
format = pkgs.formats.yaml { };
cfg = config.services.evdevremapkeys;
in
{
options.services.evdevremapkeys = {
enable = mkEnableOption (lib.mdDoc ''evdevremapkeys'');
settings = mkOption {
type = format.type;
default = { };
description = lib.mdDoc ''
config.yaml for evdevremapkeys
'';
};
};
config = mkIf cfg.enable {
boot.kernelModules = [ "uinput" ];
services.udev.extraRules = ''
KERNEL=="uinput", MODE="0660", GROUP="input"
'';
users.groups.evdevremapkeys = { };
users.users.evdevremapkeys = {
description = "evdevremapkeys service user";
group = "evdevremapkeys";
extraGroups = [ "input" ];
isSystemUser = true;
};
systemd.services.evdevremapkeys = {
description = "evdevremapkeys";
wantedBy = [ "multi-user.target" ];
serviceConfig =
let
config = format.generate "config.yaml" cfg.settings;
in
{
ExecStart = "${pkgs.evdevremapkeys}/bin/evdevremapkeys --config-file ${config}";
User = "evdevremapkeys";
Group = "evdevremapkeys";
StateDirectory = "evdevremapkeys";
Restart = "always";
LockPersonality = true;
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
PrivateNetwork = true;
PrivateTmp = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectKernelTunables = true;
ProtectSystem = true;
};
};
};
}