mastodon: initial setup
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2023-01-17 22:36:39 +00:00
parent 3188862fe9
commit 01675c85cb
10 changed files with 194 additions and 1 deletions

View File

@ -6,6 +6,7 @@
./desktop/awesome/default.nix ./desktop/awesome/default.nix
./locations.nix ./locations.nix
./resilio.nix ./resilio.nix
./services/mastodon/default.nix
./services/matrix.nix ./services/matrix.nix
./tailscale.nix ./tailscale.nix
./www/global.nix ./www/global.nix

View File

@ -14,6 +14,7 @@ in
default = { default = {
services = { services = {
matrix = "vm.strangervm.ts.hillion.co.uk"; matrix = "vm.strangervm.ts.hillion.co.uk";
mastodon = "vm.strangervm.ts.hillion.co.uk";
}; };
}; };
}; };
@ -21,5 +22,6 @@ in
config = lib.mkIf cfg.autoServe { config = lib.mkIf cfg.autoServe {
custom.services.matrix.enable = cfg.locations.services.matrix == config.networking.fqdn; custom.services.matrix.enable = cfg.locations.services.matrix == config.networking.fqdn;
custom.services.mastodon.enable = cfg.locations.services.mastodon == config.networking.fqdn;
}; };
} }

View File

@ -0,0 +1,58 @@
{ config, pkgs, lib, ... }:
let
cfg = config.custom.services.mastodon;
in
{
options.custom.services.mastodon = {
enable = lib.mkEnableOption "mastodon";
};
config = lib.mkIf cfg.enable {
age.secrets = {
"mastodon/otp_secret_file" = {
file = ../../../secrets/mastodon/social.hillion.co.uk/otp_secret_file.age;
owner = config.services.mastodon.user;
group = config.services.mastodon.group;
};
"mastodon/secret_key_base" = {
file = ../../../secrets/mastodon/social.hillion.co.uk/secret_key_base.age;
owner = config.services.mastodon.user;
group = config.services.mastodon.group;
};
"mastodon/vapid_private_key" = {
file = ../../../secrets/mastodon/social.hillion.co.uk/vapid_private_key.age;
owner = config.services.mastodon.user;
group = config.services.mastodon.group;
};
"mastodon/mastodon_at_social.hillion.co.uk" = {
file = ../../../secrets/mastodon/social.hillion.co.uk/mastodon_at_social.hillion.co.uk.age;
owner = config.services.mastodon.user;
group = config.services.mastodon.group;
};
};
services.mastodon = {
enable = true;
localDomain = "social.hillion.co.uk";
vapidPublicKeyFile = builtins.path { path = ./vapid_public_key; };
otpSecretFile = config.age.secrets."mastodon/otp_secret_file".path;
secretKeyBaseFile = config.age.secrets."mastodon/secret_key_base".path;
vapidPrivateKeyFile = config.age.secrets."mastodon/vapid_private_key".path;
smtp = {
user = "mastodon@social.hillion.co.uk";
port = 587;
passwordFile = config.age.secrets."mastodon/mastodon_at_social.hillion.co.uk".path;
host = "smtp.eu.mailgun.org";
fromAddress = "mastodon@social.hillion.co.uk";
authenticate = true;
};
extraConfig = {
EMAIL_DOMAIN_WHITELIST = "hillion.co.uk";
};
};
};
}

View File

@ -0,0 +1 @@
BNC88033km7UbxwclsVwr8k8Fe0ndQzeEwc9v4IqEtnU2YMLDKBsZ9eGBPXOQwClnqa-PxxuHSkxeDRC_uQdzb0=

View File

@ -10,6 +10,8 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
users.users.caddy.extraGroups = [ "mastodon" ];
services.caddy = { services.caddy = {
enable = true; enable = true;
@ -49,7 +51,41 @@ in
virtualHosts."drone.hillion.co.uk".extraConfig = '' virtualHosts."drone.hillion.co.uk".extraConfig = ''
reverse_proxy http://vm.strangervm.ts.hillion.co.uk:18733 reverse_proxy http://vm.strangervm.ts.hillion.co.uk:18733
''; '';
virtualHosts."social.hillion.co.uk".extraConfig = ''
handle_path /system/* {
file_server * {
root /var/lib/mastodon/public-system
}
}
handle /api/v1/streaming/* {
reverse_proxy unix//run/mastodon-streaming/streaming.socket
}
route * {
file_server * {
root ${pkgs.mastodon}/public
pass_thru
}
reverse_proxy * unix//run/mastodon-web/web.socket
}
handle_errors {
root * ${pkgs.mastodon}/public
rewrite 500.html
file_server
}
encode gzip
header /* {
Strict-Transport-Security "max-age=31536000;"
}
header /emoji/* Cache-Control "public, max-age=31536000, immutable"
header /packs/* Cache-Control "public, max-age=31536000, immutable"
header /system/accounts/avatars/* Cache-Control "public, max-age=31536000, immutable"
header /system/media_attachments/files/* Cache-Control "public, max-age=31536000, immutable"
'';
}; };
}; };
} }

View File

@ -0,0 +1,22 @@
age-encryption.org/v1
-> ssh-rsa GxPFJQ
fR5abxPrwpYFhEty3T8Zx7u3K5HzIRujjj5aZP84+7gZlEE+Fjj7+F1cWk2QeM38
x1YHA5psEsuWAqtAQ/v9Rp/JHFH+HcO6imEIaFv2Lg1tv8IswT995ynejr0E1wN/
QKzVXhyqXbTHB6EsGKrzxHAK4GcqXwPFV4JWSYQ+Q2JSDkX4j7yM6kT7k7OI32ZO
RmhezWUp5FfZp37NJAJdBQNTqp/nvYLc3X9Wq4kFrvWZNRrh1Yix7vIv0iaqvoHY
JWLb9NLQA9RfSKnAVIlbbhNZzMBdCH2zPjNFPdRFHilqcGzxL5NZcEnPcvgwdLU3
wrxCU0ZlDDVM6PPR4wnf6A
-> ssh-rsa K9mW1w
YMUoAeS+odaUTqNrPpUdno5+X2FEtYKJXoELKAV73FzEZPRGqx6QOW66T7I1T6Ta
bI8DN0APAhw5iQLzyfQAqCTk+e9OpVMKhOz9aoOvTUMWQvzFnLPplUBrfqErKf0N
ynivabBZDu4bYlveUxvDootS0BEGqMX521+GfHXXrnF1kswmQU9iBjaXOJ6ee5kA
uuRXYjdvMCRdxt4IfPsmds5sxmQmb3TtqDTglYF/bGSJRvCuTFE2RJReqR0J7fI8
7X/v1BXqZ4/USFcaAvDTejynzw7XbVd0QxF8pvyovnC8QAcNEOSW03ZTWa72SAyH
sIN+E5WM8vByNDMM9SbtyQ
-> ssh-ed25519 O0LMHg DyROBi4kg7STbIT2AQebM2l+PIxRVGHzIzeJNFCckwU
tdNtu0iX9DbBcGO++S3FNpPi0bhs8VblZZ1vG+JAtpQ
-> pp5-grease h K,g1$` -W-'z=\ PFC!
b5JA7LoHsCfpp/rgBBETM+EOZSEqILdpmkWU2kmJdBvpFG+4oCUFD+el2azOiZpf
VSgZiCfct2WDZuEEdZyWAcmRd+z7
--- Wngnx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Zisv8kK9aQZYvTaMS
5ddMYrdpxJeGJAtO6ir3yw
-> ssh-ed25519 O0LMHg yHLnNQMahSSgXtWmyAurXI7+bvlJhg4edg/G+AzGAkk
PDbS4LjOhHY6GIfQAojtDYpUJV3xS4nAAnvhfhMui3I
-> TQ~'V\-grease vuL/7@ .YbM/Fv$
sJRsjd41yeR2gJRv567GFh9a6G55o7Jd00QYxPPp
--- dClpo30O0AgOaIbkTeyPuuLgV5xCVwj9TpOMJ8fGUJo
Œ˜:çÓUYÎ,7™D{µCÏÓö
1 TÂCQɶ*f=„gCkú«<C3BA>]'šúeûWfìšÄ«~”†£E¸
ÊãÍ:å²ÑA 

View File

@ -65,4 +65,10 @@ in
# Drone Secrets # Drone Secrets
"drone/gitea_client_secret.age".publicKeys = jake_users ++ [ ts.strangervm.vm ]; "drone/gitea_client_secret.age".publicKeys = jake_users ++ [ ts.strangervm.vm ];
"drone/rpc_secret.age".publicKeys = jake_users ++ [ ts.strangervm.vm ]; "drone/rpc_secret.age".publicKeys = jake_users ++ [ ts.strangervm.vm ];
# Mastodon Secrets
"mastodon/social.hillion.co.uk/otp_secret_file.age".publicKeys = jake_users ++ [ ts.strangervm.vm ];
"mastodon/social.hillion.co.uk/secret_key_base.age".publicKeys = jake_users ++ [ ts.strangervm.vm ];
"mastodon/social.hillion.co.uk/vapid_private_key.age".publicKeys = jake_users ++ [ ts.strangervm.vm ];
"mastodon/social.hillion.co.uk/mastodon_at_social.hillion.co.uk.age".publicKeys = jake_users ++ [ ts.strangervm.vm ];
} }