Setup Mastodon

This commit is contained in:
Paul-Henri Froidmont 2022-12-01 02:31:13 +01:00
parent 41519afebe
commit dc7cff3140
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
8 changed files with 96 additions and 3 deletions

50
modules/mastodon.nix Normal file
View file

@ -0,0 +1,50 @@
{ config, lib, ... }:
with lib;
let
cfg = config.custom.services.mastodon;
in
{
options.custom.services.mastodon = {
enable = mkEnableOption "mastodon";
};
config = mkIf cfg.enable {
sops.secrets = {
mastodonDbPassword = {
owner = config.users.users.mastodon.name;
key = "mastodon/db_password";
restartUnits = [ "mastodon-init-db.service" ];
};
noreplyFroidmontPassword = {
owner = config.users.users.mastodon.name;
key = "email/accounts_passwords/noreply_froidmont_clear";
};
};
services.mastodon = {
enable = true;
localDomain = "social.froidmont.org";
configureNginx = true;
database = {
createLocally = false;
host = "10.0.1.11";
name = "mastodon";
user = "mastodon";
passwordFile = config.sops.secrets.mastodonDbPassword.path;
};
smtp = {
createLocally = false;
authenticate = true;
host = "mail.banditlair.com";
port = 465;
fromAddress = "noreply@froidmont.org";
user = "noreply@froidmont.org";
passwordFile = config.sops.secrets.noreplyFroidmontPassword.path;
};
extraConfig = {
SMTP_SSL = "true";
};
};
};
}