1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-06 16:57:08 +00:00
nix-darwin/modules/services/khd/default.nix

60 lines
1.4 KiB
Nix
Raw Normal View History

2017-01-25 22:50:12 +01:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.khd;
in
{
options = {
2017-05-14 14:27:38 +02:00
services.khd.enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the khd hototkey daemon.";
};
2017-01-25 22:50:12 +01:00
2017-05-14 14:27:38 +02:00
services.khd.package = mkOption {
type = types.package;
default = pkgs.khd;
defaultText = "pkgs.khd";
2017-05-14 14:27:38 +02:00
description = "This option specifies the khd package to use.";
2017-01-25 22:50:12 +01:00
};
services.khd.enableAccessibilityAccess = mkOption {
type = types.bool;
default = false;
description = "Whether to enable accessibility permissions for the khd daemon.";
};
services.khd.khdConfig = mkOption {
type = types.lines;
default = "";
example = "alt + shift - r : kwmc quit";
};
2017-01-25 22:50:12 +01:00
};
config = mkIf cfg.enable {
security.accessibilityPrograms = mkIf cfg.enableAccessibilityAccess [ "${cfg.package}/bin/khd" ];
environment.etc."khdrc".text = cfg.khdConfig;
2017-01-25 22:50:12 +01:00
launchd.user.agents.khd = {
path = [ cfg.package pkgs.kwm config.environment.systemPath ];
serviceConfig.ProgramArguments = [ "${cfg.package}/bin/khd" "-c" "/etc/khdrc" ];
2017-01-25 22:50:12 +01:00
serviceConfig.KeepAlive = true;
serviceConfig.ProcessType = "Interactive";
serviceConfig.Sockets.Listeners =
{ SockServiceName = "3021";
SockType = "dgram";
SockFamily = "IPv4";
};
};
};
}