2017-01-25 22:50:12 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.khd;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.khd = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable the khd hototkey daemon.";
|
|
|
|
};
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
default = pkgs.khd;
|
2017-02-19 12:07:54 +01:00
|
|
|
description = "This option specifies the khd package to use.";
|
2017-01-25 22:50:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
launchd.user.agents.khd = {
|
2017-02-26 14:46:42 +01:00
|
|
|
path = [ cfg.package pkgs.kwm "${config.environment.systemPath}:" ];
|
2017-01-25 22:50:12 +01:00
|
|
|
serviceConfig.Program = "${cfg.package}/bin/khd";
|
|
|
|
serviceConfig.KeepAlive = true;
|
|
|
|
serviceConfig.ProcessType = "Interactive";
|
|
|
|
serviceConfig.Sockets.Listeners =
|
|
|
|
{ SockServiceName = "3021";
|
|
|
|
SockType = "dgram";
|
|
|
|
SockFamily = "IPv4";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|