about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/services/invidious.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/services/invidious.nix b/modules/services/invidious.nix
new file mode 100644
index 0000000..17fec9f
--- /dev/null
+++ b/modules/services/invidious.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.modules.services.invidious;
+in
+{
+  options.modules.services.invidious = {
+    enable = mkEnableOption "invidious instance";
+
+    domain = mkOption { type = types.str; };
+    realHost = mkOption { type = types.str; default = "invidious.${cfg.domain}"; };
+    secrets = {
+      invidious-hmac-key = mkOption { type = types.path; description = "path to the file containing the HMAC key"; };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    services.invidious = {
+      enable = true;
+
+      port = 4003;
+      domain = cfg.realHost;
+
+      hmacKeyFile = cfg.secrets.invidious-hmac-key;
+
+      settings = {
+        db.user = "indivious";
+        captions = [ "English" "Japanese" "Korean" ];
+        check_tables = true;
+      };
+    };
+  };
+}