nixos-piaware/modules/options/theairtraffic.nix

157 lines
4.4 KiB
Nix
Raw Normal View History

2023-12-13 23:32:42 -06:00
##
## theairtraffic.com
##
{ cfg, lib, netConnector, UUID }: lib.options.mkOption {
type = lib.types.submodule {
options = {
name = lib.options.mkOption {
type = lib.types.enum [
"adsbexchange"
"adsbfi"
"theairtraffic"
];
};
username = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.str (
username: (builtins.match ''^[a-zA-Z0-9_-]+$'' username) != null
));
default = null;
example = "'william34-london' or 'william34-jersey'";
description = "A unique name to be shown on the MLAT map";
};
uuid = lib.options.mkOption {
type = UUID;
};
mlat = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = false;
description = "Enable MLAT client.";
};
input = lib.options.mkOption {
type = lib.types.submodule {
options = {
host = lib.options.mkOption {
type = lib.types.str;
default = "127.0.0.1";
example = "127.0.0.1";
description = "";
};
port = lib.options.mkOption {
type = lib.types.port;
default = 30005;
example = 30005;
description = "";
};
type = lib.options.mkOption {
type = lib.types.enum [
"dump1090"
"radarcape_gps"
];
default = "dump1090";
example = "dump1090";
description = "";
};
};
};
default = { };
};
reduceInterval = lib.options.mkOption {
type = lib.types.float;
default = 0.5;
example = "0.5";
description = "";
};
results = lib.options.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"beast,connect,127.0.0.1:${toString cfg.theairtraffic.feed.beastInputPort}"
];
description = "";
};
privacy = lib.options.mkOption {
type = lib.types.bool;
default = false;
description = ''
Sets the privacy flag for this receiver. Currently, this removes the receiver
location pin from the coverage maps.
'';
};
server = lib.options.mkOption {
type = lib.types.str;
default = "feed.theairtraffic.com:31090";
example = "feed.theairtraffic.com:31090";
description = "Server to feed MLAT data to";
};
};
};
};
feed = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = false;
description = "Enable theairtraffic.com feeder.";
};
beastInputPort = lib.options.mkOption {
type = lib.types.port;
default = 30156;
description = "Port to accept Beast messages on.";
};
connectors = lib.options.mkOption {
type = lib.types.listOf netConnector;
default = [
{
protocol = "uat_in";
primary = {
host = "127.0.0.1";
port = 30978;
};
silentFail = true;
}
{
protocol = "beast_in";
primary = {
host = "127.0.0.1";
port = 30005;
};
silentFail = true;
}
{
protocol = "beast_reduce_out";
primary = {
host = "feed.theairtraffic.com";
port = 30004;
};
}
];
};
};
};
};
};
};
}