From 0eb8384f0a8ed662c60934b7fa44f39d1b97fa7a Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Wed, 25 Jan 2017 22:50:12 +0100 Subject: [PATCH] fix khd service --- modules/launchd/default.nix | 2 +- modules/services/khd.nix | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 modules/services/khd.nix diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index d7c50549..16e761c2 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -35,7 +35,7 @@ let path = mkOption { type = types.listOf types.path; default = []; - apply = ps: makeBinPath ps; + apply = ps: "${makeBinPath ps}"; description = '' Packages added to the service's PATH environment variable. Both the bin diff --git a/modules/services/khd.nix b/modules/services/khd.nix new file mode 100644 index 00000000..85cef828 --- /dev/null +++ b/modules/services/khd.nix @@ -0,0 +1,44 @@ +{ 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; + description = "This option specifies the khd package to use"; + }; + + }; + }; + + config = mkIf cfg.enable { + + launchd.user.agents.khd = { + serviceConfig.Program = "${cfg.package}/bin/khd"; + serviceConfig.KeepAlive = true; + serviceConfig.ProcessType = "Interactive"; + serviceConfig.Sockets.Listeners = + { SockServiceName = "3021"; + SockType = "dgram"; + SockFamily = "IPv4"; + }; + }; + + }; +}