8 cfg = config.programs.ydotool;
12 maintainers = with lib.maintainers; [ quantenzitrone ];
15 options.programs.ydotool = {
16 enable = lib.mkEnableOption ''
17 ydotoold system service and {command}`ydotool` for members of
18 {option}`programs.ydotool.group`.
20 group = lib.mkOption {
24 Group which users must be in to use {command}`ydotool`.
30 runtimeDirectory = "ydotoold";
31 in lib.mkIf cfg.enable {
32 users.groups."${config.programs.ydotool.group}" = { };
34 systemd.services.ydotoold = {
35 description = "ydotoold - backend for ydotool";
36 wantedBy = [ "multi-user.target" ];
37 partOf = [ "multi-user.target" ];
39 Group = config.programs.ydotool.group;
40 RuntimeDirectory = runtimeDirectory;
41 RuntimeDirectoryMode = "0750";
42 ExecStart = "${lib.getExe' pkgs.ydotool "ydotoold"} --socket-path=${config.environment.variables.YDOTOOL_SOCKET} --socket-perm=0660";
46 ## allow access to uinput
47 DeviceAllow = [ "/dev/uinput" ];
48 DevicePolicy = "closed";
50 ## allow creation of unix sockets
51 RestrictAddressFamilies = [ "AF_UNIX" ];
53 CapabilityBoundingSet = "";
54 IPAddressDeny = "any";
55 LockPersonality = true;
56 MemoryDenyWriteExecute = true;
57 NoNewPrivileges = true;
58 PrivateNetwork = true;
63 ProtectControlGroups = true;
65 ProtectHostname = true;
66 ProtectKernelLogs = true;
67 ProtectKernelModules = true;
68 ProtectKernelTunables = true;
69 ProtectProc = "invisible";
70 ProtectSystem = "strict";
71 RestrictNamespaces = true;
72 RestrictRealtime = true;
73 RestrictSUIDSGID = true;
74 SystemCallArchitectures = "native";
82 # -> systemd-analyze security score 0.7 SAFE 😀
86 environment.variables = {
87 YDOTOOL_SOCKET = "/run/${runtimeDirectory}/socket";
89 environment.systemPackages = with pkgs; [ ydotool ];