summary refs log tree commit diff stats
path: root/modules/nixos/vhack/peertube/default.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-27 09:37:29 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-27 09:38:56 +0200
commit580b011a7f69daf155354e9a99ecba20f9bb68f4 (patch)
treef7735f894513005945f85d0e9b3f723ecbc22478 /modules/nixos/vhack/peertube/default.nix
parentfix(nix-sync): Change last occurrences of `repo.path` to `repoPath` (diff)
downloadnixos-server-580b011a7f69daf155354e9a99ecba20f9bb68f4.tar.gz
nixos-server-580b011a7f69daf155354e9a99ecba20f9bb68f4.zip
feat(peertube): Init
Diffstat (limited to '')
-rw-r--r--modules/nixos/vhack/peertube/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/nixos/vhack/peertube/default.nix b/modules/nixos/vhack/peertube/default.nix
new file mode 100644
index 0000000..193b628
--- /dev/null
+++ b/modules/nixos/vhack/peertube/default.nix
@@ -0,0 +1,61 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}: let
+  cfg = config.vhack.peertube;
+in {
+  options.vhack.peertube = {
+    enable = lib.mkEnableOption ''
+      the peertube video platform.
+    '';
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.peertube = {
+      enable = true;
+
+      localDomain = "peertube.vhack.eu";
+      configureNginx = true;
+
+      smtp = {
+        createLocally = true;
+        passwordFile = "${config.age.secrets.peertubeSmtp.path}";
+      };
+      database = {
+        createLocally = true;
+      };
+      redis = {
+        enableUnixSocket = true;
+        createLocally = true;
+      };
+
+      secrets.secretsFile = "${config.age.secrets.peertubeGeneral.path}";
+    };
+
+    age.secrets = {
+      peertubeGeneral = {
+        file = ./secrets/general.age;
+        mode = "700";
+        owner = "peertube";
+        group = "peertube";
+      };
+      peertubeSmtp = {
+        file = ./secrets/smtp.age;
+        mode = "700";
+        owner = "peertube";
+        group = "peertube";
+      };
+    };
+
+    environment.persistence."/srv".directories = [
+      {
+        directory = "/var/lib/peertube";
+        user = "peertube";
+        group = "peertube";
+        mode = "0700";
+      }
+    ];
+  };
+}