modules/rnsd: play with format a bit..

This commit is contained in:
Aaron Bieber 2024-01-31 18:21:56 -07:00
parent 5785a96042
commit 7212011e40
No known key found for this signature in database
2 changed files with 48 additions and 31 deletions

View File

@ -181,40 +181,54 @@ in
services = {
rnsd = {
enable = false;
enable = true;
settings = {
reticulum = {
enable_transport = true;
shared_instance = true;
shared_instance_port = 37428;
instance_control_port = 37429;
panic_on_interface_error = true;
};
logging = {
loglevel = 4;
loglevel = 8;
};
interfaces = {
"Default Interface" = {
enabled = true;
type = "AutoInterface";
enabled = true;
};
"UDP Interface" = {
type = "UDPInterface";
enabled = true;
listen_ip = "0.0.0.0";
listen_port = 4242;
forward_ip = "255.255.255.255";
forward_port = 4242;
};
"TCP Interface" = {
type = "TCPServerInterface";
enabled = true;
listen_ip = "0.0.0.0";
listen_port = 4242;
forward_ip = "255.255.255.255";
forward_port = 4242;
};
"RNS Testnet BetweenTheBorders" = {
type = "TCPClientInterface";
enabled = true;
mode = "boundary";
target_host = "betweentheborders.com";
target_port = 4242;
type = "TCPClientInterface";
};
"RNode LoRa Interface" = {
bandwidth = 125000;
codingrate = 5;
enabled = false;
flow_control = false;
frequency = 915000000;
mode = "ap";
port = "/dev/ttyACM0";
spreadingfactor = 9;
txpower = 7;
type = "RNodeInterface";
};
"RNode BT LoRa Interface" = {
bandwidth = 125000;
codingrate = 5;
enabled = true;
flow_control = false;
frequency = 915000000;
mode = "ap";
port = "/dev/rfcomm0";
spreadingfactor = 9;
txpower = 7;
type = "RNodeInterface";
};
};
};

View File

@ -6,8 +6,8 @@
let
cfg = config.services.rnsd;
defaultSettings = { };
settingsFormat = pkgs.formats.toml { };
settingsFile = settingsFormat.generate "config.toml" cfg.settings;
settingsFormat = pkgs.formats.json { };
settingsFile = settingsFormat.generate "rnsd-config.json" cfg.settings;
in
{
options = with lib; {
@ -51,10 +51,17 @@ in
'';
};
#port = lib.mkOption {
# type = types.int;
# defautl = 4242;
# defaultText = "4242";
# description = "Port to use for establishing an isolated net";
#};
openFirewall = mkOption {
type = types.bool;
default = false;
description = "enable veilid-server in the firewall";
description = "enable rnsd in the firewall";
};
};
};
@ -73,6 +80,7 @@ in
home = "${cfg.dataDir}";
createHome = true;
group = "${cfg.group}";
extraGroups = [ "dialout" ];
};
systemd.services.rnsd = {
enable = true;
@ -81,15 +89,10 @@ in
after = [ "network-online.target" ];
serviceConfig = {
#DynamicUser = true;
#User = "rnsd";
#Group = "rnsd";
#StateDirectory = "rnsd";
#CacheDirectory = "rnsd";
#LogsDirectory = "rnsd";
#ProtectHome = true;
User = cfg.user;
Group = cfg.group;
ExecStartPre = "${pkgs.coreutils}/bin/ln -sf ${settingsFile} ${cfg.dataDir}/config";
ExecStart = "${cfg.package}/bin/rnsd -v --config ${cfg.dataDir}";
ExecStart = "${cfg.package}/bin/rnsd -s -v --config ${cfg.dataDir}";
};
};
};