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

97 lines
3.4 KiB
Nix

{ 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 ADS-B Exchange MLAT map (map.adsbexchange.com/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 ADS-B Exchange 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.adsbexchange.feed.beastInputPort}"
];
description = "Where to send results of MLAT computations.";
};
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.adsbexchange.com:31090";
example = "feed.adsbexchange.com:31090";
description = "Server to feed MLAT data to";
};
};
};
default = { };
};
feed = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = false;
description = "Enable ADS-B Exchange feeder.";
};
beastInputPort = lib.options.mkOption {
type = lib.types.port;
default = 30154;
description = "Port to accept Beast messages on.";
};
};
};
};
};
};
default = { };
}