-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathydotool-service.nix
More file actions
34 lines (30 loc) · 1006 Bytes
/
ydotool-service.nix
File metadata and controls
34 lines (30 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ config, pkgs, lib, ... }:
{
# Create systemd service for ydotoold
systemd.services.ydotoold = {
description = "ydotool daemon";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.ydotool}/bin/ydotoold --socket-path=/run/ydotoold/socket --socket-perm=0660";
Restart = "always";
RuntimeDirectory = "ydotoold";
RuntimeDirectoryMode = "0750";
# Run as root to access /dev/uinput
User = "root";
Group = "input";
};
};
# Add your user to input group for device access
users.users.jordan.extraGroups = [ "input" ];
# Create udev rule to make /dev/uinput accessible
services.udev.extraRules = ''
KERNEL=="uinput", GROUP="input", MODE="0660"
'';
# Create a wrapper script that uses the system socket
environment.systemPackages = [
(pkgs.writeScriptBin "ydotool-client" ''
#!${pkgs.bash}/bin/bash
exec ${pkgs.ydotool}/bin/ydotool --socket-path=/run/ydotoold/socket "$@"
'')
];
}