configuration/packages/ydotoold.nix

32 lines
839 B
Nix

# Requires uinput group created by KMonad module
{ config, lib, pkgs, ... }:
let
cfg = config.services.ydotoold;
in
{
options.services.ydotoold = {
enable = lib.mkEnableOption "ydotool daemon";
package = lib.mkOption { type = lib.types.package; default = pkgs.ydotool; };
};
config = lib.mkIf cfg.enable (
{
users.groups.ydotool = { };
users.users.ydotool = {
description = "ydotool daemon";
group = "ydotool";
isSystemUser = true;
};
systemd.services.ydotoold = {
wantedBy = [ "multi-user.target" ]; # Pending NixOS/nixpkgs#169143
description = "ydotool daemon";
serviceConfig.User = "ydotool";
serviceConfig.SupplementaryGroups = [ "uinput" ];
script = "${cfg.package}/bin/ydotoold --socket-perm 0660";
};
}
);
}