2022-09-02 04:05:55 +00:00
|
|
|
# Requires uinput group created by KMonad module
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2023-06-16 18:11:55 +00:00
|
|
|
inherit (lib) mkEnableOption mkIf mkOption;
|
|
|
|
inherit (lib.types) package;
|
|
|
|
|
2022-09-02 04:05:55 +00:00
|
|
|
cfg = config.services.ydotoold;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.ydotoold = {
|
2023-06-16 18:11:55 +00:00
|
|
|
enable = mkEnableOption "ydotool daemon";
|
|
|
|
package = mkOption { type = package; default = pkgs.ydotool; };
|
2022-09-02 04:05:55 +00:00
|
|
|
};
|
|
|
|
|
2023-06-16 18:11:55 +00:00
|
|
|
config = mkIf cfg.enable {
|
2023-01-21 02:59:40 +00:00
|
|
|
users.groups.ydotool = { };
|
2022-09-02 04:05:55 +00:00
|
|
|
|
2023-01-21 02:59:40 +00:00
|
|
|
users.users.ydotool = {
|
|
|
|
description = "ydotool daemon";
|
|
|
|
group = "ydotool";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
2022-09-02 04:05:55 +00:00
|
|
|
|
2023-06-16 20:41:45 +00:00
|
|
|
systemd.tmpfiles.rules = [ "d /run/ydotool - ydotool ydotool -" ];
|
|
|
|
|
2023-01-21 02:59:40 +00:00
|
|
|
systemd.services.ydotoold = {
|
|
|
|
wantedBy = [ "multi-user.target" ]; # Pending NixOS/nixpkgs#169143
|
|
|
|
description = "ydotool daemon";
|
|
|
|
serviceConfig.User = "ydotool";
|
|
|
|
serviceConfig.SupplementaryGroups = [ "uinput" ];
|
2023-06-16 20:41:45 +00:00
|
|
|
script = "${cfg.package}/bin/ydotoold --socket-path /run/ydotool/ydotool.sock --socket-perm 0660";
|
2023-01-21 02:59:40 +00:00
|
|
|
};
|
|
|
|
};
|
2022-09-02 04:05:55 +00:00
|
|
|
}
|