nitter: add guest account support to systemd service

This commit is contained in:
Raghav Sood 2023-12-19 16:45:28 +08:00
parent 63599993b6
commit 2595f503cd
No known key found for this signature in database
GPG key ID: 13D53E9EB65DE19C

View file

@ -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 { redisCreateLocally = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -333,8 +350,12 @@ in
after = [ "network-online.target" ]; after = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
DynamicUser = true; DynamicUser = true;
LoadCredential="guestAccountsFile:${cfg.guestAccounts}";
StateDirectory = "nitter"; 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, # Some parts of Nitter expect `public` folder in working directory,
# see https://github.com/zedeus/nitter/issues/414 # see https://github.com/zedeus/nitter/issues/414
WorkingDirectory = "${cfg.package}/share/nitter"; WorkingDirectory = "${cfg.package}/share/nitter";