From 4c6606be31a32463613fb99faa363e04c494423a Mon Sep 17 00:00:00 2001 From: Chandler Swift Date: Tue, 14 Jan 2025 23:12:25 -0600 Subject: [PATCH] bert: Add owntracks-recorder --- bert/configuration.nix | 1 + bert/services/http/index.nix | 1 + .../http/whereis.chandlerswift.com.nix | 9 +++++++++ bert/services/owntracks-recorder.nix | 19 +++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 bert/services/http/whereis.chandlerswift.com.nix create mode 100644 bert/services/owntracks-recorder.nix diff --git a/bert/configuration.nix b/bert/configuration.nix index e26c1ef..61f79b1 100644 --- a/bert/configuration.nix +++ b/bert/configuration.nix @@ -9,6 +9,7 @@ ./services/monitoring.nix ./services/forgejo.nix ./services/navidrome.nix + ./services/owntracks-recorder.nix ]; # Bootloader diff --git a/bert/services/http/index.nix b/bert/services/http/index.nix index b6cb723..d0fba6f 100644 --- a/bert/services/http/index.nix +++ b/bert/services/http/index.nix @@ -14,6 +14,7 @@ ./preview.chandlerswift.com.nix ./stjohnscccc.org.nix ./swiftgang.net.nix + ./whereis.chandlerswift.com.nix ]; services.caddy = { diff --git a/bert/services/http/whereis.chandlerswift.com.nix b/bert/services/http/whereis.chandlerswift.com.nix new file mode 100644 index 0000000..f561c3f --- /dev/null +++ b/bert/services/http/whereis.chandlerswift.com.nix @@ -0,0 +1,9 @@ +{config, ...}: { + services.caddy.virtualHosts."whereis.chandlerswift.com".extraConfig = '' + reverse_proxy localhost:8083 + + handle_errors { + respond "{err.status_code} {err.status_text}" + } + ''; +} diff --git a/bert/services/owntracks-recorder.nix b/bert/services/owntracks-recorder.nix new file mode 100644 index 0000000..ffe97b5 --- /dev/null +++ b/bert/services/owntracks-recorder.nix @@ -0,0 +1,19 @@ +{pkgs, ...}: +let # off my branch until https://github.com/NixOS/nixpkgs/pull/373934 is merged + package = (import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/7ebad821473c78c7cfdf17ecf9f9be91d2455d81.tar.gz") {}).owntracks-recorder; +in +{ + systemd.services.owntracks-recorder = { + enable = true; + description = "owntracks-recorder Service"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + serviceConfig = { + ExecStart = "${package}/bin/ot-recorder --storage /var/lib/owntracks --port 0"; + DynamicUser = true; + StateDirectory = "owntracks"; + StateDirectoryMode = "0775"; + WorkingDirectory = "/var/lib/owntracks"; + }; + }; +}