65 lines
2.3 KiB
Nix
65 lines
2.3 KiB
Nix
{ lib, config, pkgs, ... }:
|
||
with lib;
|
||
let
|
||
cfg = config.services.satnogs-client-docker;
|
||
in
|
||
{
|
||
|
||
options.services.satnogs-client-docker = {
|
||
enable = mkEnableOption "satnogs-client docker service";
|
||
|
||
satnogs-api-token = mkOption {
|
||
type = types.str;
|
||
description = mdDoc ''
|
||
It is recommended to use additional-env-files instead and provide the token,
|
||
via something like agenix, so that it wont end up in the nix-store;
|
||
|
||
The API token assigned to your ground station on the SatNOGS Network website,
|
||
please don’t share your api key as this can give access to anyone to upload and change
|
||
things in network related to your station and its observations.
|
||
|
||
To find your API token, log in to network.satnogs.org,
|
||
click on the user icon at the top right corner and then click on the "Dashboard" option.
|
||
On the top of the dashboard page right under the user icon click the button "API key" to show your API token.
|
||
'';
|
||
};
|
||
|
||
satnogs-soapy-rx-device = mkOption {
|
||
type = types.str;
|
||
description = mdDoc ''
|
||
If you are using an RTL-SDR, this is `driver=rtlsdr`.
|
||
For other devices tested configurations can be found at [Software Defined Radio](https://wiki.satnogs.org/Software_Defined_Radio).
|
||
See [pothosware/SoapyRTLSDR/wiki#modules](https://github.com/pothosware/SoapyRTLSDR/wiki#modules) for other SDR modules.
|
||
If multiple devices are attached to your station you should also specify the serial of the desired device here,
|
||
e.g. `driver=uhd,serial=3164495`.
|
||
'';
|
||
};
|
||
|
||
|
||
};
|
||
|
||
config = mkIf cfg.enable {
|
||
warnings = [
|
||
mkIf
|
||
(cfg.satnogs-api-token != "")
|
||
"It is not recommended to use some form of secret management e.g. agenix to store your token."
|
||
];
|
||
|
||
virtualisation.docker.enable = true;
|
||
|
||
systemd.services.satnogs-docker-compose = {
|
||
script = concatStringsSep " \\\n " ([
|
||
"${pkgs.docker-compose}/bin/docker-compose"
|
||
"-f ${./satnogs-docker-compose.yml}"
|
||
]
|
||
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") satnogs-env)
|
||
++ [ "up" ]);
|
||
|
||
preStop = "${pkgs.docker-compose}/bin/docker-compose -f ${./satnogs-docker-compose.yml} down";
|
||
|
||
wantedBy = [ "multi-user.target" ];
|
||
after = [ "docker.service" "docker.socket" ];
|
||
};
|
||
};
|
||
}
|