summary refs log tree commit diff stats
path: root/modules/nixos/vhack/peertube/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos/vhack/peertube/default.nix')
-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";
+      }
+    ];
+  };
+}