about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorRaghav Sood <r@raghavsood.com>2023-12-19 16:45:28 +0800
committerRaghav Sood <r@raghavsood.com>2023-12-20 00:01:20 +0800
commit2595f503cd2d0e781f12b9893bafa0437e1196f9 (patch)
treee4fda3aa00b1465371973afdf4b8382d90736cb0 /nixos/modules/services
parent63599993b60770618f9683d204a85abe66272382 (diff)
nitter: add guest account support to systemd service
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/misc/nitter.nix23
1 files changed, 22 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/nitter.nix b/nixos/modules/services/misc/nitter.nix
index c2c462d46bb5b..d2cf7c0de2b77 100644
--- a/nixos/modules/services/misc/nitter.nix
+++ b/nixos/modules/services/misc/nitter.nix
@@ -304,6 +304,23 @@ in
         '';
       };
 
+      guestAccounts = mkOption {
+        type = types.path;
+        default = "/var/lib/nitter/guest_accounts.jsonl";
+        description = lib.mdDoc ''
+          Path to the guest accounts file.
+
+          This file contains a list of guest accounts that can be used to
+          access the instance without logging in. The file is in JSONL format,
+          where each line is a JSON object with the following fields:
+
+          {"oauth_token":"some_token","oauth_token_secret":"some_secret_key"}
+
+          See https://github.com/zedeus/nitter/wiki/Guest-Account-Branch-Deployment
+          for more information on guest accounts and how to generate them.
+        '';
+      };
+
       redisCreateLocally = mkOption {
         type = types.bool;
         default = true;
@@ -333,8 +350,12 @@ in
         after = [ "network-online.target" ];
         serviceConfig = {
           DynamicUser = true;
+          LoadCredential="guestAccountsFile:${cfg.guestAccounts}";
           StateDirectory = "nitter";
-          Environment = [ "NITTER_CONF_FILE=/var/lib/nitter/nitter.conf" ];
+          Environment = [
+            "NITTER_CONF_FILE=/var/lib/nitter/nitter.conf"
+            "NITTER_ACCOUNTS_FILE=%d/guestAccountsFile"
+          ];
           # Some parts of Nitter expect `public` folder in working directory,
           # see https://github.com/zedeus/nitter/issues/414
           WorkingDirectory = "${cfg.package}/share/nitter";