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";
|
|
|
|
sha256 = "b1986c87e44efcf08abaf2bb818f319e8d3dceb9f2f1a49d50e1c5bfc4434e64";
|
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];
|
|
|
|
akkoma_fe = nix-packages.packages.${pkgs.system}.akkoma-fe;
|
|
|
|
akkoma_admin_fe = nix-packages.packages.${pkgs.system}.akkoma-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
|
|
|
'';
|
|
|
|
};
|
|
|
|
akkconfig = builtins.replaceStrings ["%AKKOMA_STATIC_DIR%"] ["${static_dir}"] (builtins.readFile ./akkoma.exs);
|
|
|
|
in {
|
2022-09-09 17:59:43 +00:00
|
|
|
services.pleroma = {
|
|
|
|
enable = true;
|
|
|
|
package = nix-packages.packages.${pkgs.system}.akkoma;
|
2022-09-12 10:03:10 +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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|