new trafic-stop-box config format for zw and mobile

This commit is contained in:
oxapentane - 2022-07-10 20:34:06 +02:00
parent 366c9ecfa2
commit dab0cec2a0
Signed by: oxapentane
GPG Key ID: 91FA5E5BF9AA901C
4 changed files with 30 additions and 137 deletions

View File

@ -2,6 +2,6 @@
"name": "Zentralwerk",
"lat": 51.0810632,
"lon": 13.7280758,
"id": "61ef8e8b-f4d8-4d1d-8fa8-1a1d3d48888e",
"region": 14612000
"id": "8aa034af-3545-4c36-b235-17e46cad6f07",
"region": 0
}

View File

@ -2,6 +2,6 @@
"name": "Mobile",
"lat": 0,
"lon": 0,
"station_id": 1000,
"region": "dresden"
"id": "285a6f4e-9123-4fcf-beeb-092463256c74",
"region": 0
}

View File

@ -0,0 +1,26 @@
let
file = ../../configs/mobile_box.json;
in
{
dump-dvb = {
gnuradio = {
enable = true;
device = "hackrf=0";
frequency = 170795000;
offset = 19550;
}
telegram-decoder = {
enable = true;
server = [ "http://127.0.0.1:8080" ];
configFile = file;
};
data-accumulator = {
enable = true;
host = "0.0.0.0";
port = 8080;
DB.backend = "CSV";
CSVFile = "/var/lib/data-accumulator/formatted.csv";
};
wartrammer.enable = true;
};
}

View File

@ -1,133 +0,0 @@
{ pkgs, ... }:
let
file = ../../configs/mobile_box.json;
in
{
systemd = {
services = {
"gnuradio" = {
enable = true;
wantedBy = [ "multi-user.target" ];
script = "exec ${pkgs.gnuradio-decoder}/bin/gnuradio-decoder-cpp 170795000 19550 &";
serviceConfig = {
Type = "forking";
User = "gnuradio";
Restart = "on-failure";
StartLimitBurst = "2";
StartLimitIntervalSec = "150s";
};
};
"telegram-decoder" = {
enable = true;
wantedBy = [ "multi-user.target" ];
script = "exec ${pkgs.telegram-decoder}/bin/telegram-decode --config ${file} --server http://127.0.0.1:8080 &";
serviceConfig = {
Type = "forking";
User = "telegram-decoder";
Restart = "on-failure";
StartLimitBurst = "2";
StartLimitIntervalSec = "150s";
};
};
"data-accumulator" = {
enable = true;
wantedBy = [ "multi-user.target" ];
script = ''
exec ${pkgs.data-accumulator}/bin/data-accumulator --host 0.0.0.0 --port 8080&
'';
environment = {
"CSV_FILE" = "/var/lib/data-accumulator/formatted.csv";
};
serviceConfig = {
Type = "forking";
User = "data-accumulator";
Restart = "on-failure";
StartLimitBurst = "2";
StartLimitIntervalSec = "150s";
};
};
"wartrammer" = {
enable = true;
wantedBy = [ "multi-user.target" ];
script = ''
exec ${pkgs.wartrammer-backend}/bin/wartrammer-40k --port 7680
'';
serviceConfig = {
Type = "forking";
User = "wartrammer";
Restart = "on-failure";
StartLimitBurst = "2";
StartLimitIntervalSec = "150s";
};
};
"start-wifi-hotspot" = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
};
script = ''
${pkgs.linux-router}/bin/lnxrouter --ap wlp0s20u2 dump-dvb -g 10.3.141.1 -p trolling-dvb
'';
};
};
};
services = {
nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"wartrammer" = {
locations = {
"/" = {
root = "${pkgs.wartrammer-frontend}/bin/";
index = "index.html";
};
"/api" = {
proxyPass = "http://127.0.0.1:7680";
};
};
};
};
};
};
environment.systemPackages = with pkgs; [
usbutils
hackrf
iw
tcpdump
];
# user accounts for systemd units
users.users = {
data-accumulator = {
name = "data-accumulator";
description = "";
isNormalUser = true;
};
wartrammer = {
name = "wartrammer";
description = "";
isNormalUser = true;
};
};
security.wrappers = {
gnuradio-decode = {
owner = "gnuradio";
group = "users";
capabilities = "cap_sys_nice+eip";
source = "${pkgs.gnuradio-decoder}/bin/gnuradio-decoder-cpp";
};
};
}