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.nextcloud;
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
2024-10-06 15:16:52 +00:00
|
|
|
options.custom.containers.nextcloud.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}/nextcloud/.env" = secret "${config.custom.profile}/nextcloud/.env";
|
|
|
|
"${config.custom.profile}/nextcloud/db.env" = secret "${config.custom.profile}/nextcloud/db.env";
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
#?? arion-nextcloud pull
|
|
|
|
environment.shellAliases.arion-nextcloud = "sudo arion --prebuilt-file ${config.virtualisation.arion.projects.nextcloud.settings.out.dockerComposeYaml}";
|
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
virtualisation.arion.projects.nextcloud.settings.services = {
|
|
|
|
# https://github.com/nextcloud/docker
|
|
|
|
nextcloud.service = {
|
|
|
|
container_name = "nextcloud";
|
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/nextcloud/.env".path];
|
|
|
|
image = "nextcloud:29-apache";
|
|
|
|
ports = ["127.0.0.1:8181:80"];
|
|
|
|
restart = "unless-stopped";
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
volumes = [
|
|
|
|
"${config.custom.containers.directory}/nextcloud/app:/var/www/html"
|
|
|
|
"${config.custom.containers.directory}/nextcloud/data:/var/www/html/data"
|
|
|
|
];
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
depends_on = [
|
|
|
|
"db"
|
|
|
|
"cache"
|
|
|
|
];
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
cron.service = {
|
|
|
|
container_name = "nextcloud-cron";
|
|
|
|
entrypoint = "/cron.sh";
|
|
|
|
image = "nextcloud:29-apache";
|
|
|
|
restart = "unless-stopped";
|
|
|
|
volumes =
|
|
|
|
config.virtualisation.arion.projects.nextcloud.settings.services.nextcloud.service.volumes; # volumes_from
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
depends_on = [
|
|
|
|
"db"
|
|
|
|
"cache"
|
|
|
|
];
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
cache.service = {
|
|
|
|
container_name = "nextcloud-cache";
|
|
|
|
image = "redis:latest";
|
|
|
|
restart = "unless-stopped";
|
|
|
|
volumes = ["${config.custom.containers.directory}/nextcloud/cache:/data"];
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
db.service = {
|
|
|
|
container_name = "nextcloud-db";
|
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/nextcloud/db.env".path];
|
|
|
|
image = "postgres:15";
|
|
|
|
restart = "unless-stopped";
|
2024-09-09 00:22:14 +00:00
|
|
|
|
2024-10-08 23:23:50 +00:00
|
|
|
volumes = [
|
|
|
|
"${config.custom.containers.directory}/nextcloud/db:/var/lib/postgresql/data"
|
|
|
|
];
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|