nix-config/hosts/containers/nncp/default.nix

66 lines
1.8 KiB
Nix
Raw Normal View History

2022-01-15 11:28:23 +01:00
{ config, lib, pkgs, ... }:
{
boot.loader.initScript.enable = lib.mkForce false;
c3d2.mergeNncpSettings = false;
c3d2.hq.statistics.enable = true;
2022-01-15 11:28:23 +01:00
networking = {
hostName = "nncp";
firewall.enable = false;
};
programs.nncp = {
enable = true;
secrets = [ "/etc/nncp.secrets" ];
settings = {
mcd-listen = [ "eth0" ];
mcd-send.eth0 = 60;
neigh = # use c3d2.nncp.neigh but remove this node
2022-01-24 21:02:20 +01:00
let
nightCall = {
cron = "0 0 4 * * * *"; # 4:00
maxonlinetime = 14400; # vier stunde
xx = "tx"; # transmit only
when-tx-exists = true;
};
in lib.mapAttrs (name: value:
value // {
calls = lib.optional ((value.addrs or { }) != { }) [ nightCall ];
via = lib.lists.remove "c3d2" value.via;
}) (builtins.removeAttrs config.c3d2.nncp.neigh [ "c3d2" ]);
2022-01-15 11:28:23 +01:00
};
};
services.collectd.plugins.exec = let
util =
pkgs.runCommand "collectd_nncp" { nativeBuildInputs = [ pkgs.nim ]; } ''
cp ${./collectd_nncp.nim} ./collectd_nncp.nim
nim c --nimcache:. -o:$out ./collectd_nncp.nim
'';
in ''
Exec "${config.services.collectd.user}" "${util}" "${config.programs.nncp.settings.spool}"
'';
users.groups.uucp.members = [ config.services.collectd.user ];
2022-01-15 11:28:23 +01:00
services.nncp = {
caller.enable = false;
daemon = {
enable = true;
socketActivation.enable = false;
};
};
systemd.services."nncp-daemon-yggdrasil" = {
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = config.systemd.services."nncp-daemon".serviceConfig // {
ExecStart =
"${pkgs.nncp}/bin/nncp-daemon -noprogress -autotoss -yggdrasil 'keyprv;;keypub;tcp://[2a00:8180:2c00:281:9000::1]:1337'";
};
};
}