synit: add NNCP services
This commit is contained in:
parent
9252ea7d08
commit
d8011166e1
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
imports = [ ./ntpd.nix ./sshd.nix ./userSettings.nix ./wifi.nix ];
|
||||
imports = [ ./nncp.nix ./ntpd.nix ./sshd.nix ./userSettings.nix ./wifi.nix ];
|
||||
environment.etc."syndicate/services/configdirs.pr".text = ''
|
||||
<require-service <config-watcher "/run/etc/syndicate/services" $.>>
|
||||
'';
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
{ 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}>
|
||||
'';
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue