2022-09-12 10:03:10 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
nix-packages,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
2022-09-15 10:36:55 +00:00
|
|
|
raccoon-emoji = pkgs.fetchzip {
|
|
|
|
url = "https://volpeon.ink/art/emojis/raccoon/raccoon.zip";
|
2022-09-16 08:00:26 +00:00
|
|
|
sha256 = "sha256-GkMiYAP0LS0TL6GMDG4R4FkGwFjhIwn3pAWUmCTUfHg=";
|
2022-09-16 07:58:14 +00:00
|
|
|
stripRoot = false;
|
2022-09-15 10:36:55 +00:00
|
|
|
};
|
2022-09-12 10:03:10 +00:00
|
|
|
static_dir = pkgs.stdenvNoCC.mkDerivation {
|
|
|
|
name = "akkoma-static";
|
|
|
|
src = pkgs.emptyDirectory;
|
|
|
|
nativeBuildInputs = with pkgs; [xorg.lndir];
|
2022-09-30 15:46:21 +00:00
|
|
|
akkoma_fe = nix-packages.packages.${pkgs.system}.pleroma-fe;
|
|
|
|
akkoma_admin_fe = nix-packages.packages.${pkgs.system}.admin-fe;
|
2022-09-15 10:36:55 +00:00
|
|
|
raccoon_emoji = raccoon-emoji;
|
2022-09-12 10:03:10 +00:00
|
|
|
dontUnpack = false;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/frontends/pleroma-fe/stable
|
|
|
|
lndir $akkoma_fe $out/frontends/pleroma-fe/stable
|
|
|
|
mkdir -p $out/frontends/admin-fe/stable
|
|
|
|
lndir $akkoma_admin_fe $out/frontends/admin-fe/stable
|
2022-09-15 10:36:55 +00:00
|
|
|
mkdir -p $out/emoji/raccoons
|
|
|
|
lndir $raccoon_emoji $out/emoji/raccoons
|
2022-09-12 10:03:10 +00:00
|
|
|
'';
|
|
|
|
};
|
2022-10-26 19:26:48 +00:00
|
|
|
ec = pkgs.formats.elixirConf {};
|
|
|
|
akkconfig = ec.generate "config.exs" (with ec.lib; {
|
|
|
|
":pleroma" = {
|
|
|
|
"Pleroma.Upload" = {
|
|
|
|
uploader = mkRaw "Pleroma.Uploaders.S3";
|
|
|
|
filters = map (v: mkRaw ("Pleroma.Upload.Filter." + v)) ["Mogrify" "Exiftool" "Dedupe" "AnonymizeFilename"];
|
|
|
|
base_url = "https://mastodon-assets.chir.rs/";
|
|
|
|
};
|
|
|
|
"Pleroma.Uploaders.S3" = {
|
|
|
|
bucket = "mastodon-chir-rs";
|
|
|
|
truncated_namespace = "";
|
|
|
|
};
|
|
|
|
"Pleroma.Upload.Filter.Mogrify" = {
|
|
|
|
args = "auto-orient";
|
|
|
|
};
|
|
|
|
":instance" = {
|
|
|
|
name = "Raccoon Noises";
|
|
|
|
email = "lotte@chir.rs";
|
|
|
|
description = "Single User Akkoma Instance";
|
|
|
|
limit = 58913;
|
|
|
|
description_limit = 58913;
|
|
|
|
upload_limit = 100000000;
|
|
|
|
languages = ["en" "tok"];
|
|
|
|
registrations_open = false;
|
|
|
|
static_dir = "${static_dir}";
|
|
|
|
max_pinned_statuses = 10;
|
|
|
|
attachment_links = true;
|
|
|
|
max_report_comment_size = 58913;
|
|
|
|
safe_dm_mentions = true;
|
|
|
|
healthcheck = true;
|
|
|
|
user_bio_length = 58913;
|
|
|
|
user_name_length = 621;
|
|
|
|
max_account_fields = 69;
|
|
|
|
max_remote_account_fields = 621;
|
|
|
|
account_field_name_length = 621;
|
|
|
|
account_field_value_length = 58913;
|
|
|
|
registration_reason_length = 621;
|
|
|
|
external_user_synchronization = true;
|
|
|
|
cleanup_attachments = true;
|
|
|
|
};
|
|
|
|
":markup" = {
|
|
|
|
allow_headings = true;
|
|
|
|
allow_tables = true;
|
|
|
|
allow_fonts = true;
|
|
|
|
};
|
|
|
|
":frontend_configurations" = {
|
|
|
|
pleroma_fe = mkMap {
|
|
|
|
webPushNotifications = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
":activitypub".authorized_fetch_mode = true;
|
|
|
|
":mrf_simple" = let
|
2022-10-26 19:32:41 +00:00
|
|
|
processMap = m: map (k: mkTuple [k m.${k}]) (builtins.attrNames m);
|
2022-10-26 19:26:48 +00:00
|
|
|
in {
|
|
|
|
reject = processMap {
|
|
|
|
"qoto.org" = "Freeze Peach";
|
|
|
|
"poa.st" = "Hosting neonazis";
|
|
|
|
"kiwifarms.cc" = "Targeted Harassment";
|
|
|
|
"pmth.us" = "Harassment";
|
|
|
|
"nicecrew.digital" = "TERF Instance";
|
|
|
|
"freespeechextremist.com" = "Freeze Peach";
|
|
|
|
"ryona.agency" = "Freeze Peach";
|
|
|
|
"howlr.me" = "Run by verified kiwifarms user";
|
|
|
|
"rdrama.cc" = "smells like Kiwifarms shit";
|
|
|
|
};
|
|
|
|
media_removal = processMap {
|
|
|
|
"a.rathersafe.space" = "posting borderline illegal imagery as the fediblock account";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
":mrf" = {
|
|
|
|
policies = map (v: mkRaw ("Pleroma.Web.ActivityPub.MRF." + v)) ["SimplePolicy" "EnsureRePrepended" "MediaProxyWarmingPolicy" "ForceBotUnlistedPolicy" "AntiFollowbotPolicy" "ObjectAgePolicy" "TagPolicy" "RequireImageDescription"];
|
|
|
|
transparency = true;
|
|
|
|
};
|
|
|
|
":https_security".sts = true;
|
|
|
|
":frontends" = {
|
|
|
|
primary = mkMap {
|
|
|
|
name = "pleroma-fe";
|
|
|
|
ref = "stable";
|
|
|
|
};
|
|
|
|
admin = mkMap {
|
|
|
|
name = "admin-fe";
|
|
|
|
ref = "stable";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
"Pleroma.Repo" = {
|
|
|
|
adapter = mkRaw "Ecto.Adapters.Postgres";
|
|
|
|
database = "akkoma";
|
|
|
|
pool_size = 10;
|
|
|
|
socket_dir = "/run/postgresql";
|
|
|
|
};
|
|
|
|
"Pleroma.Web.Endpoint".url = {
|
|
|
|
host = "akko.chir.rs";
|
|
|
|
port = 443;
|
|
|
|
scheme = "https";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
":web_push_encryption".":vapid_details".subject = "lotte@chir.rs";
|
|
|
|
});
|
2022-09-12 10:03:10 +00:00
|
|
|
in {
|
2022-09-09 17:59:43 +00:00
|
|
|
services.pleroma = {
|
|
|
|
enable = true;
|
|
|
|
package = nix-packages.packages.${pkgs.system}.akkoma;
|
2022-10-26 19:26:48 +00:00
|
|
|
configs = ["${akkconfig}"];
|
2022-09-09 17:59:43 +00:00
|
|
|
user = "akkoma";
|
|
|
|
group = "akkoma";
|
|
|
|
secretConfigFile = config.sops.secrets."services/akkoma.exs".path;
|
|
|
|
};
|
2022-09-12 10:03:10 +00:00
|
|
|
systemd.services.pleroma.path = with pkgs; [exiftool imagemagick ffmpeg];
|
2022-09-09 17:59:43 +00:00
|
|
|
services.postgresql.ensureDatabases = ["akkoma"];
|
|
|
|
services.postgresql.ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "akkoma";
|
|
|
|
ensurePermissions = {"DATABASE akkoma" = "ALL PRIVILEGES";};
|
|
|
|
}
|
|
|
|
];
|
2022-09-12 10:03:10 +00:00
|
|
|
sops.secrets."services/akkoma.exs" = {owner = "akkoma";};
|
2022-09-09 17:59:43 +00:00
|
|
|
services.caddy.virtualHosts."akko.chir.rs" = {
|
|
|
|
useACMEHost = "chir.rs";
|
|
|
|
extraConfig = ''
|
|
|
|
import baseConfig
|
|
|
|
handle /media_attachments/* {
|
|
|
|
redir https://mastodon-assets.chir.rs{uri} permanent
|
|
|
|
}
|
|
|
|
handle {
|
|
|
|
reverse_proxy {
|
|
|
|
to http://127.0.0.1:4000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|