2014-12-13 16:48:39 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.gdomap;
|
2015-01-25 16:34:52 +00:00
|
|
|
pidFile = "${cfg.pidDir}/gdomap.pid";
|
2014-12-13 16:48:39 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
#
|
|
|
|
# interface
|
|
|
|
#
|
|
|
|
options = {
|
|
|
|
services.gdomap = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable gdomap, the GNUstep distributed objects daemon.
|
|
|
|
|
|
|
|
Note that gdomap runs as root.
|
|
|
|
";
|
|
|
|
};
|
2015-01-25 16:34:52 +00:00
|
|
|
pidDir = mkOption {
|
|
|
|
default = "/var/run/gdomap";
|
|
|
|
description = "Location of the file which stores the PID of gdomap";
|
|
|
|
};
|
2014-12-13 16:48:39 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
#
|
|
|
|
# implementation
|
|
|
|
#
|
|
|
|
config = mkIf config.services.gdomap.enable {
|
|
|
|
# NOTE: gdomap runs as root
|
2015-01-25 16:34:52 +00:00
|
|
|
# TODO: extra user for gdomap?
|
2014-12-13 16:48:39 +00:00
|
|
|
systemd.services.gdomap = {
|
|
|
|
description = "gdomap server";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "network.target" ];
|
|
|
|
path = [ pkgs.gnustep_base ];
|
|
|
|
preStart = ''
|
2015-01-25 16:34:52 +00:00
|
|
|
mkdir -m 0700 -p ${cfg.pidDir}
|
|
|
|
chown -R nobody:nobody ${cfg.pidDir}
|
2014-12-13 16:48:39 +00:00
|
|
|
'';
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "@${pkgs.gnustep_base}/bin/gdomap"
|
2015-01-25 16:34:52 +00:00
|
|
|
+ " -d -p"
|
|
|
|
+ " -I ${pidFile}";
|
|
|
|
# + " -j ${cfg.pidDir}";
|
|
|
|
Restart = "always";
|
2014-12-13 16:48:39 +00:00
|
|
|
RestartSec = 2;
|
|
|
|
TimeoutStartSec = "30";
|
|
|
|
Type = "forking";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|