nixos-piaware/modules/options/adsbfi.nix
2023-12-13 23:32:42 -06:00

145 lines
4.3 KiB
Nix

##
## ADSB.fi configuration options
##
{ cfg, lib, netConnector, UUID }:
lib.options.mkOption {
type = lib.types.submodule {
options = {
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 ADSB.fi 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 ADSD.fi 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.adsbfi.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.adsb.fi:31090";
example = "feed.adsb.fi: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 ADSB.fi feeder.";
};
beastInputPort = lib.options.mkOption {
type = lib.types.port;
default = 30155;
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.adsb.fi";
port = 30004;
};
secondary = {
host = "feed.adsb.fi";
port = 64004;
};
}
];
};
};
};
};
};
};
}