59 lines
1.7 KiB
Nix
59 lines
1.7 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
lib' = lib.extend (import ../../../lib.nix);
|
|
toPreserves = lib'.generators.toPreserves { };
|
|
cfg = config.services.nncp;
|
|
pkg = config.programs.nncp.package;
|
|
in {
|
|
options = {
|
|
|
|
services.nncp = {
|
|
caller = {
|
|
enable = lib.mkEnableOption ''
|
|
croned NNCP TCP daemon caller.
|
|
The daemon will take configuration from
|
|
<xref linkend="opt-programs.nncp.settings"/>
|
|
'';
|
|
extraArgs = lib.mkOption {
|
|
type = with lib.types; listOf str;
|
|
description = "Extra command-line arguments to pass to caller.";
|
|
default = [ ];
|
|
example = [ "-autotoss" ];
|
|
};
|
|
};
|
|
|
|
daemon = {
|
|
enable = lib.mkEnableOption ''
|
|
NNCP TCP synronization daemon.
|
|
The daemon will take configuration from
|
|
<xref linkend="opt-programs.nncp.settings"/>
|
|
'';
|
|
extraArgs = lib.mkOption {
|
|
type = with lib.types; listOf str;
|
|
description = "Extra command-line arguments to pass to daemon.";
|
|
default = [ ];
|
|
example = [ "-autotoss" ];
|
|
};
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
config = (lib.mkIf cfg.daemon.enable {
|
|
environment.etc."syndicate/services/nncp-daemon.pr".text =
|
|
let exec = [ "${pkg}/bin/nncp-daemon" ] ++ cfg.daemon.extraArgs;
|
|
in ''
|
|
<require-service <daemon nncp-daemon>>
|
|
<daemon nncp-daemon ${toPreserves exec}>
|
|
'';
|
|
}) // (lib.mkIf cfg.caller.enable {
|
|
environment.etc."syndicate/services/nncp-caller.pr".text =
|
|
let exec = [ "${pkg}/bin/nncp-caller" ] ++ cfg.caller.extraArgs;
|
|
in ''
|
|
<require-service <daemon nncp-caller>>
|
|
<daemon nncp-caller ${toPreserves exec}>
|
|
'';
|
|
});
|
|
}
|