From 278e172881d082159b035b4643838c2d4e28e7a7 Mon Sep 17 00:00:00 2001 From: Katherina Walshe-Grey Date: Mon, 28 Apr 2025 15:18:41 +0100 Subject: [PATCH] owncast: init --- hosts/kalessin/default.nix | 7 +++++++ services/default.nix | 1 + services/owncast.nix | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 services/owncast.nix diff --git a/hosts/kalessin/default.nix b/hosts/kalessin/default.nix index 65a0ced..2b80d96 100644 --- a/hosts/kalessin/default.nix +++ b/hosts/kalessin/default.nix @@ -28,6 +28,7 @@ in randomcat.services.zfs.datasets = { "rpool_kalessin/state" = { mountpoint = "none"; }; + "rpool_kalessin/state/owncast" = { mountpoint = "/var/lib/owncast"; }; }; services.sanoid.datasets."rpool_kalessin/state" = { @@ -36,5 +37,11 @@ in process_children_only = true; }; + qenya.services.owncast = { + enable = true; + domain = "live.qenya.tel"; + dataDir = "/var/lib/owncast"; + }; + system.stateVersion = "23.11"; } diff --git a/services/default.nix b/services/default.nix index 9a3f8cb..927886c 100644 --- a/services/default.nix +++ b/services/default.nix @@ -6,6 +6,7 @@ ./forgejo.nix ./jellyfin.nix ./navidrome.nix + ./owncast.nix ./remote-builder.nix ./web-redirect.nix ]; diff --git a/services/owncast.nix b/services/owncast.nix new file mode 100644 index 0000000..aa60223 --- /dev/null +++ b/services/owncast.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkIf mkOption mkEnableOption types; + cfg = config.qenya.services.owncast; +in +{ + options.qenya.services.owncast = { + enable = mkEnableOption "Owncast"; + domain = mkOption { + type = types.str; + }; + dataDir = mkOption { + type = types.str; + }; + }; + + config = mkIf cfg.enable { + services.nginx = { + enable = true; + virtualHosts = { + ${cfg.domain} = { + forceSSL = true; + enableACME = true; + locations."/".proxyPass = "http://127.0.0.1:8080/"; + }; + }; + }; + + networking.firewall.allowedTCPPorts = [ 80 443 1935 ]; # 1935 for rtmp + + services.owncast.enable = true; + services.owncast.dataDir = cfg.dataDir; + }; +}