programs.nncp moved upstream
This commit is contained in:
parent
b7212e2060
commit
af8c1e2c9a
|
@ -11,43 +11,6 @@ let
|
||||||
pkg = programCfg.package;
|
pkg = programCfg.package;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
programs.nncp = {
|
|
||||||
|
|
||||||
enable = mkEnableOption "NNCP (Node to Node copy) utilities";
|
|
||||||
|
|
||||||
package = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.nncp;
|
|
||||||
defaultText = literalExpression "pkgs.nncp";
|
|
||||||
description = "The NNCP package to use system-wide.";
|
|
||||||
};
|
|
||||||
|
|
||||||
secrets = mkOption {
|
|
||||||
type = with types; listOf str;
|
|
||||||
example = [ "/run/keys/nncp.hjson" ];
|
|
||||||
description = ''
|
|
||||||
A list of paths to NNCP configuration files that should not be
|
|
||||||
in the Nix store. These files are layered on top of the values at
|
|
||||||
<xref linkend="opt-programs.nncp.settings"/>.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
settings = mkOption {
|
|
||||||
type = settingsFormat.type;
|
|
||||||
description = ''
|
|
||||||
NNCP configuration, see
|
|
||||||
<link xlink:href="http://www.nncpgo.org/Configuration.html"/>.
|
|
||||||
At runtime these settings will be overlayed by the contents of
|
|
||||||
<xref linkend="opt-programs.nncp.secrets"/> into the file
|
|
||||||
<literal>${nncpCfgFile}</literal>. Node keypairs go in
|
|
||||||
<literal>secrets</literal>, do not specify them in
|
|
||||||
<literal>settings</literal> as they will be leaked into
|
|
||||||
<literal>/nix/store</literal>!
|
|
||||||
'';
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
services.nncp = {
|
services.nncp = {
|
||||||
|
|
||||||
|
@ -110,35 +73,6 @@ in {
|
||||||
message = "NNCP caller enabled but call configuration is missing";
|
message = "NNCP caller enabled but call configuration is missing";
|
||||||
}];
|
}];
|
||||||
|
|
||||||
programs.nncp.settings = {
|
|
||||||
spool = mkDefault "/var/spool/nncp";
|
|
||||||
log = mkDefault "/var/spool/nncp/log";
|
|
||||||
};
|
|
||||||
|
|
||||||
environment = mkIf programCfg.enable {
|
|
||||||
systemPackages = [ pkg ];
|
|
||||||
etc."nncp.hjson".source = nncpCfgFile;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"d ${programCfg.settings.spool} 0770 root uucp"
|
|
||||||
"f ${programCfg.settings.log} 0770 root uucp"
|
|
||||||
];
|
|
||||||
|
|
||||||
system.activationScripts.nncp = ''
|
|
||||||
nncpCfgDir=$(mktemp --directory nncp.XXXXXXXXXX)
|
|
||||||
for f in ${jsonCfgFile} ${toString config.programs.nncp.secrets}; do
|
|
||||||
tmpdir=$(mktemp --directory nncp.XXXXXXXXXX)
|
|
||||||
${pkg}/bin/nncp-cfgdir -cfg $f -dump $tmpdir
|
|
||||||
${pkgs.findutils}/bin/find $tmpdir -size 1c -delete
|
|
||||||
cp -a $tmpdir/* $nncpCfgDir/
|
|
||||||
rm -rf $tmpdir
|
|
||||||
done
|
|
||||||
${pkg}/bin/nncp-cfgdir -load $nncpCfgDir > ${nncpCfgFile}
|
|
||||||
rm -rf $nncpCfgDir
|
|
||||||
chgrp uucp ${nncpCfgFile}
|
|
||||||
'';
|
|
||||||
|
|
||||||
systemd.services."nncp-caller" = {
|
systemd.services."nncp-caller" = {
|
||||||
inherit (callerCfg) enable;
|
inherit (callerCfg) enable;
|
||||||
description = "Croned NNCP TCP daemon caller.";
|
description = "Croned NNCP TCP daemon caller.";
|
||||||
|
|
Loading…
Reference in New Issue