nixos-piaware/modules/options/dump1090.nix

294 lines
9.8 KiB
Nix
Raw Permalink Normal View History

2023-12-13 23:32:42 -06:00
{ lib }:
lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkEnableOption "Dump1090";
errorCorrection = lib.options.mkOption {
type = lib.types.bool;
default = true;
};
maxRange = lib.options.mkOption {
type = lib.types.addCheck lib.types.int (x: x >= 0);
default = 360;
description = "Absolute maximum range for position decoding (in NM)";
};
jsonLocationAccuracy = lib.options.mkOption {
type = lib.types.enum [ 0 1 2 ];
default = 2;
description = "Accuracy of receiver location in json metadata (0=no location, 1=approximate, 2=exact)";
};
adaptiveDynamicRange = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = true;
description = "Adjust gain for target dynamic range";
};
target = lib.options.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
description = "Set target dynamic range in dB";
};
alpha = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.float (alpha: alpha >= 0.0 && alpha <= 1.0));
default = null;
description = "Set dynamic range noise smoothing factor (0..1, smaller=more smoothing)";
};
percentile = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.int (x: x >= 0 && x <= 100));
default = null;
description = "Set dynamic range noise percentile";
};
changeDelay = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.int (x: x >= 0));
default = null;
description = "Set delay after changing gain before resuming dynamic range control (seconds)";
};
scanDelay = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.int (x: x >= 0));
default = null;
description = "Set scan interval for dynamic range gain scanning following a gain decrease due to an increase in noise (seconds)";
};
rescanDelay = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.int (x: x >= 0));
default = null;
description = "Set periodic rescan interval for dynamic range gain scanning (seconds)";
};
};
};
default = { };
description = "Configuration options for adaptive dynamic range.";
};
device = lib.options.mkOption {
type = lib.types.submodule {
options = {
type = lib.options.mkOption {
type = lib.types.enum [ "rtlsdr" "bladerf" "hackrf" "limesdr" ];
default = "rtlsdr";
};
rtlsdr = lib.options.mkOption {
type = lib.types.submodule {
options = {
serial = lib.options.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "select device by serial";
};
index = lib.options.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
description = "select device by index";
};
enableAgc = lib.options.mkOption {
type = lib.types.bool;
default = false;
description = "enable digital AGC (not tuner AGC!)";
};
frequencyCorrection = lib.options.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
description = "set oscillator frequency correction in PPM";
};
directSamplingMode = lib.options.mkOption {
type = lib.types.nullOr (lib.types.enum [ 0 1 2 ]);
default = null;
description = "set direct sampling mode";
};
};
};
};
gain = lib.options.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
description = "Set gain in dB (default: varies by SDR type)";
};
frequency = lib.options.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
description = "Set frequency (default: 1090 Mhz)";
};
};
};
};
network = lib.options.mkOption {
type = lib.types.submodule {
options = {
raw = lib.options.mkOption {
type = lib.types.submodule {
options = {
input = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = false;
description = "Enable TCP raw input";
};
ports = lib.options.mkOption {
type = lib.types.listOf lib.types.port;
default = [ 30001 ];
description = "TCP raw input listen ports (default: 30001)";
};
};
};
default = { };
};
output = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = true;
description = "Enable TCP raw output";
};
ports = lib.options.mkOption {
type = lib.types.listOf lib.types.port;
default = [ 30002 ];
description = "TCP raw output listen ports (default: 30002)";
};
size = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.int (x: x >= 0));
default = null;
description = "TCP output minimum size (default: 0)";
};
interval = lib.options.mkOption {
type = lib.types.nullOr (lib.types.addCheck lib.types.int (x: x >= 0));
default = null;
description = "TCP output memory flush rate in seconds (default: 0)";
};
};
};
default = { };
};
};
};
default = { };
};
baseStation = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = true;
};
ports = lib.options.mkOption {
type = lib.types.listOf lib.types.port;
default = [ 30003 ];
};
};
};
default = { };
};
beast = lib.options.mkOption {
type = lib.types.submodule {
options = {
input = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = true;
};
ports = lib.options.mkOption {
type = lib.types.listOf lib.types.port;
default = [ 30004 30104 ];
};
};
};
default = { };
};
output = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = true;
};
ports = lib.options.mkOption {
type = lib.types.listOf lib.types.port;
default = [ 30005 ];
};
};
};
default = { };
};
stratux = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
type = lib.types.bool;
default = false;
};
ports = lib.options.mkOption {
type = lib.types.listOf lib.types.port;
default = [ ];
};
};
};
default = { };
};
};
};
default = { };
};
};
};
default = { };
};
extraOptions = lib.options.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
};
}