feat: add roam-location service to jellybee
This commit is contained in:
parent
9551514466
commit
761cd326cf
4 changed files with 44 additions and 7 deletions
|
|
@ -26,6 +26,23 @@ in {
|
|||
default = 30;
|
||||
description = "How often to poll the Starlink dish for location, in seconds";
|
||||
};
|
||||
webdav = {
|
||||
url = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "WebDAV URL to append location snapshots to";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "WebDAV username";
|
||||
};
|
||||
passwordFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = "Path to file containing the WebDAV password";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
@ -57,12 +74,23 @@ in {
|
|||
environment = {
|
||||
STARLINK_HOST = cfg.starlinkHost;
|
||||
POLL_INTERVAL_SECONDS = toString cfg.pollIntervalSeconds;
|
||||
} // lib.optionalAttrs (cfg.webdav.url != null) {
|
||||
WEBDAV_URL = cfg.webdav.url;
|
||||
} // lib.optionalAttrs (cfg.webdav.user != null) {
|
||||
WEBDAV_USER = cfg.webdav.user;
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${roam-location}/bin/roam-location";
|
||||
ExecStart = if cfg.webdav.passwordFile != null
|
||||
then pkgs.writeShellScript "roam-location-start" ''
|
||||
export WEBDAV_PASSWORD=$(< "$CREDENTIALS_DIRECTORY/webdav_password")
|
||||
exec ${roam-location}/bin/roam-location
|
||||
''
|
||||
else "${roam-location}/bin/roam-location";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
DynamicUser = true;
|
||||
} // lib.optionalAttrs (cfg.webdav.passwordFile != null) {
|
||||
LoadCredential = "webdav_password:${cfg.webdav.passwordFile}";
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 22495 ];
|
||||
|
|
|
|||
10
flake.lock
10
flake.lock
|
|
@ -1010,16 +1010,18 @@
|
|||
"roam-location": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1775825296,
|
||||
"narHash": "sha256-EH+JWLgrAt5jZDwteX0m3CmHYOxFf9sKmDPUDso4OaI=",
|
||||
"lastModified": 1775832350,
|
||||
"narHash": "sha256-AUFLkP1Xb4uJ2e6Asa226mFudreiX3PTaELdbJ6Ow0g=",
|
||||
"lastModified": 1775932944,
|
||||
"narHash": "sha256-sBW/p4+dtEHKXYpvZufYDxcxv7hXmzqRLmP3BEuHNOo=",
|
||||
"owner": "acaloiaro",
|
||||
"repo": "roam-location",
|
||||
"rev": "3e4a26e6d002f03627c6d895a799af6bd9333e14",
|
||||
"rev": "2aa59c57b07c6d85de50e753f57b4f9f810f6ff0",
|
||||
"rev": "5dae01b00f60bc42b5afae50679a7eba63f10ffa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "acaloiaro",
|
||||
"ref": "starlink-location",
|
||||
"repo": "roam-location",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
};
|
||||
|
||||
inputs.roam-location = {
|
||||
url = "github:acaloiaro/roam-location/starlink-location";
|
||||
url = "github:acaloiaro/roam-location";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,14 @@
|
|||
};
|
||||
};
|
||||
|
||||
my.services.roam-location.enable = true;
|
||||
my.services.roam-location = {
|
||||
enable = true;
|
||||
webdav = {
|
||||
url = "https://oc.adriano.fyi/remote.php/dav/spaces/83a99993-00a1-444a-aa64-dbb3ba57660b$a1baa040-cba8-4118-ba06-46277c732f60/Data/location";
|
||||
user = "adriano";
|
||||
passwordFile = config.age.secrets.opencloud_webdav_password.path;
|
||||
};
|
||||
};
|
||||
|
||||
my = {
|
||||
opencloud = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue