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 = { services = {
rnsd = { rnsd = {
enable = false; enable = true;
settings = { settings = {
reticulum = { reticulum = {
enable_transport = true; enable_transport = true;
shared_instance = true;
shared_instance_port = 37428;
instance_control_port = 37429;
panic_on_interface_error = true;
}; };
logging = { logging = {
loglevel = 4; loglevel = 8;
}; };
interfaces = { interfaces = {
"Default Interface" = { "Default Interface" = {
enabled = true;
type = "AutoInterface"; 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" = { "RNS Testnet BetweenTheBorders" = {
type = "TCPClientInterface";
enabled = true; enabled = true;
mode = "boundary";
target_host = "betweentheborders.com"; target_host = "betweentheborders.com";
target_port = 4242; 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 let
cfg = config.services.rnsd; cfg = config.services.rnsd;
defaultSettings = { }; defaultSettings = { };
settingsFormat = pkgs.formats.toml { }; settingsFormat = pkgs.formats.json { };
settingsFile = settingsFormat.generate "config.toml" cfg.settings; settingsFile = settingsFormat.generate "rnsd-config.json" cfg.settings;
in in
{ {
options = with lib; { 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 { openFirewall = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "enable veilid-server in the firewall"; description = "enable rnsd in the firewall";
}; };
}; };
}; };
@ -73,6 +80,7 @@ in
home = "${cfg.dataDir}"; home = "${cfg.dataDir}";
createHome = true; createHome = true;
group = "${cfg.group}"; group = "${cfg.group}";
extraGroups = [ "dialout" ];
}; };
systemd.services.rnsd = { systemd.services.rnsd = {
enable = true; enable = true;
@ -81,15 +89,10 @@ in
after = [ "network-online.target" ]; after = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
#DynamicUser = true; User = cfg.user;
#User = "rnsd"; Group = cfg.group;
#Group = "rnsd";
#StateDirectory = "rnsd";
#CacheDirectory = "rnsd";
#LogsDirectory = "rnsd";
#ProtectHome = true;
ExecStartPre = "${pkgs.coreutils}/bin/ln -sf ${settingsFile} ${cfg.dataDir}/config"; 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}";
}; };
}; };
}; };