about summary refs log tree commit diff
path: root/modules/server/owncast-integration/default.nix
blob: 5d931188a8cb3f6a85b8ef1bb4eaf12f69805fd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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" ];
  };
}