about summary refs log tree commit diff
path: root/modules/services/invidious.nix
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-02-03 19:00:28 +0900
committersefidel <contact@sefidel.net>2024-02-03 19:06:14 +0900
commitb12eca9efcb6f1df19b7e78d7c73179f351ac061 (patch)
tree90dd9256006addc12e969a129e0e360f0a9e168e /modules/services/invidious.nix
parentd4bd1f07275394265c0fcc2903630ca1ef0e8a1a (diff)
downloadnixrc-b12eca9efcb6f1df19b7e78d7c73179f351ac061.tar.gz
nixrc-b12eca9efcb6f1df19b7e78d7c73179f351ac061.zip
feat(modules): add invidious
Diffstat (limited to 'modules/services/invidious.nix')
-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;
+      };
+    };
+  };
+}