about summary refs log tree commit diff
path: root/modules/server/owncast-integration/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/server/owncast-integration/default.nix')
-rw-r--r--modules/server/owncast-integration/default.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/server/owncast-integration/default.nix b/modules/server/owncast-integration/default.nix
new file mode 100644
index 000000000000..5d931188a8cb
--- /dev/null
+++ b/modules/server/owncast-integration/default.nix
@@ -0,0 +1,18 @@
+{ lib, pkgs, ... }:
+
+{
+  services.nginx.virtualHosts.default.locations."= /owncast" = {
+    proxyPass = "http://unix:/run/cgiserver/owncast-integration.sock";
+  };
+
+  systemd.sockets.owncast-integration = {
+    wantedBy = [ "sockets.target" ];
+    socketConfig.ListenStream = "/run/cgiserver/owncast-integration.sock";
+  };
+
+  systemd.services.owncast-integration = {
+    path = with pkgs; [ curl jq libressl.nc ];
+    serviceConfig.ExecStart = "${lib.getExe pkgs.cgiserver} -r /owncast ${pkgs.bash}/bin/sh ${./hook.cgi.sh}";
+    serviceConfig.LoadCredential = [ "owncast-inbound" "owncast-outbound" ];
+  };
+}