2024-09-09 00:22:14 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-09-13 01:50:53 +00:00
|
|
|
with lib; let
|
2024-10-06 15:16:52 +00:00
|
|
|
cfg = config.custom.containers.mastodon;
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
2024-10-06 15:16:52 +00:00
|
|
|
options.custom.containers.mastodon.enable = mkOption {default = false;};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-09-13 01:50:53 +00:00
|
|
|
age.secrets = let
|
|
|
|
secret = filename: {
|
|
|
|
file = "${inputs.self}/secrets/${filename}";
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
|
|
|
"${config.custom.profile}/mastodon/.env" = secret "${config.custom.profile}/mastodon/.env";
|
|
|
|
"${config.custom.profile}/mastodon/db.env" = secret "${config.custom.profile}/mastodon/db.env";
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
#?? arion-mastodon pull
|
|
|
|
environment.shellAliases.arion-mastodon = "sudo arion --prebuilt-file ${config.virtualisation.arion.projects.mastodon.settings.out.dockerComposeYaml}";
|
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
virtualisation.arion.projects.mastodon.settings.services = {
|
|
|
|
# https://github.com/linuxserver/docker-mastodon
|
|
|
|
# https://github.com/mastodon/mastodon/blob/main/docker-compose.yml
|
|
|
|
mastodon.service = {
|
|
|
|
container_name = "mastodon";
|
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/mastodon/.env".path];
|
|
|
|
image = "lscr.io/linuxserver/mastodon:4.2.12";
|
|
|
|
ports = ["3000:443"];
|
|
|
|
restart = "unless-stopped";
|
|
|
|
volumes = ["${config.custom.containers.directory}/mastodon/config:/config"];
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
depends_on = [
|
|
|
|
"cache"
|
|
|
|
"db"
|
|
|
|
];
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
cache.service = {
|
|
|
|
container_name = "mastodon-cache";
|
|
|
|
image = "redis:latest";
|
|
|
|
restart = "unless-stopped";
|
|
|
|
volumes = ["${config.custom.containers.directory}/mastodon/cache:/data"];
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
db.service = {
|
|
|
|
container_name = "mastodon-db";
|
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/mastodon/db.env".path];
|
|
|
|
image = "postgres:15";
|
|
|
|
restart = "unless-stopped";
|
|
|
|
volumes = ["${config.custom.containers.directory}/mastodon/db:/var/lib/postgresql/data"];
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|