This commit is contained in:
Sebastian 2024-02-11 17:28:46 +01:00
parent c6e91fc523
commit 559256bee4
2 changed files with 125 additions and 2 deletions

View File

@ -35,7 +35,77 @@ in
'';
};
satnogs-antenna = mkOption {
type = types.str;
description = mdDoc ''
If you are using an RTL-SDR, this is RX.
For other devices tested configurations can be found at [Software Defined Radio](https://wiki.satnogs.org/Software_Defined_Radio).
If your device is not listed there yet, use `SoapySDRUtil --probe 2>&1| grep Antennas` to get available antennas.
'';
};
satnogs-rx-samp-rate = mkOption {
type = types.str;
description = mdDoc ''
Specify the receiver sampling rate.
Recommended value for RTL-SDR: 2.048e6 (for 2Msps),
other devices will need different sample rates described at [Software Defined Radio](https://wiki.satnogs.org/Software_Defined_Radio).
The command `SoapySDRUtil --probe 2>&1 | grep Sample` can be used to find all valid sample rates.
'';
};
satnogs-rf-gain = mkOption {
type = types.str;
description = mdDoc ''
RF Gain value for your SDR hardware.
Run `SoapySDRUtil --probe` to see all possible gain values for your hardware.
Example: For RTL-SDR without pre-amp, 32.8 is a good starting value.
Follow [Setting the gain](https://wiki.satnogs.org/Omnidirectional_Station_How_To#Setting_the_gain) to find a good gain value.
'';
};
satnogs-station-elev = mkOption {
type = types.str;
description = mdDoc ''
The height of your ground station above sea level in metres.
'';
};
satnogs-station-id = mkOption {
type = types.str;
description = mdDoc ''
The **numeric ID** assigned to your station in the SatNOGS Network site when the groundstation was created.
'';
};
satnogs-station-lat = mkOption {
type = types.str;
description = mdDoc ''
The latitude of your station. North is positive, south is negative.
'';
};
satnogs-station-lon = mkOption {
type = types.str;
description = mdDoc ''
The longitude of your station. East is positive, west is negative.
'';
};
additional-env-files = mkOption {
type = with types; listOf path;
default = [ ];
description = lib.mdDoc ''
Additional environment files containing settings in the form:
```
NAME = VALUE
SATNOGS_API_TOKEN = dead-beef-coffee
'';
};
};
config = mkIf cfg.enable {
@ -52,7 +122,18 @@ in
"${pkgs.docker-compose}/bin/docker-compose"
"-f ${./satnogs-docker-compose.yml}"
]
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") satnogs-env)
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") {
SATNOGS_API_TOKEN = cfg.satnogs-api-token;
SATNOGS_SOAPY_RX_DEVICE = cfg.satnogs-soapy-rx-device;
SATNOGS_ANTENNA = cfg.satnogs-antenna;
SATNOGS_RX_SAMP_RATE = cfg.satnogs-rx-samp-rate;
SATNOGS_RF_GAIN = cfg.satnogs-rf-gain;
SATNOGS_STATION_ELEV = cfg.satnogs-station-elev;
SATNOGS_STATION_ID = cfg.satnogs-station-id;
SATNOGS_STATION_LAT = cfg.satnogs-station-lat;
SATNOGS_STATION_LON = cfg.satnogs-station-lon;
})
++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles
++ [ "up" ]);
preStop = "${pkgs.docker-compose}/bin/docker-compose -f ${./satnogs-docker-compose.yml} down";

View File

@ -0,0 +1,42 @@
version: '3.8'
services:
rigctld:
image: librespace/hamlib:latest
user: '999'
read_only: true
environment:
MODEL: '1'
restart: 'unless-stopped'
command: 'rigctld'
satnogs_client:
image: librespace/satnogs-client:master # LSF stable docker image
#image: librespace/satnogs-client:master-unstable # LSF experimental docker image
#image: librespace/satnogs-client:lsf-addons # LSF stable + gr-satellites and addons
#image: librespace/satnogs-client:lsf-dev-addons # LSF unstable + gr-satellites and addons
user: '999'
read_only: true
init: true # init is needed when launching processes in the background
#env_file:
# - ./station.env
environment:
SATNOGS_RIG_IP: 'rigctld'
SATNOGS_RIG_PORT: '4532'
command: 'satnogs-client' # default
device_cgroup_rules:
- 'c 189:* rwm'
devices:
- '/dev/bus/usb'
volumes:
- type: 'tmpfs'
target: '/tmp'
- type: 'volume'
source: 'satnogs-client'
target: '/var/lib/satnogs-client'
restart: 'unless-stopped'
stop_grace_period: 1s
volumes:
satnogs-client: # persistent named volume for the station