2024-09-09 00:22:14 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-09-13 01:50:53 +00:00
|
|
|
with lib; let
|
2024-09-09 00:22:14 +00:00
|
|
|
cfg = config.custom.settings.containers.nextcloud;
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
|
|
|
options.custom.settings.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}";
|
|
|
|
|
|
|
|
virtualisation.arion.projects.nextcloud = {
|
|
|
|
serviceName = "nextcloud";
|
|
|
|
|
|
|
|
settings.services = {
|
|
|
|
# https://github.com/nextcloud/docker
|
|
|
|
nextcloud.service = {
|
|
|
|
container_name = "nextcloud";
|
2024-09-13 01:50:53 +00:00
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/nextcloud/.env".path];
|
2024-09-09 00:22:14 +00:00
|
|
|
image = "nextcloud:29-apache";
|
2024-09-13 01:50:53 +00:00
|
|
|
ports = ["127.0.0.1:8181:80"];
|
2024-09-09 00:22:14 +00:00
|
|
|
restart = "unless-stopped";
|
|
|
|
|
|
|
|
volumes = [
|
|
|
|
"${config.custom.settings.containers.directory}/nextcloud/app:/var/www/html"
|
|
|
|
"${config.custom.settings.containers.directory}/nextcloud/data:/var/www/html/data"
|
|
|
|
];
|
|
|
|
|
|
|
|
depends_on = [
|
|
|
|
"db"
|
|
|
|
"cache"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
depends_on = [
|
|
|
|
"db"
|
|
|
|
"cache"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
cache.service = {
|
|
|
|
container_name = "nextcloud-cache";
|
|
|
|
image = "redis:latest";
|
|
|
|
restart = "unless-stopped";
|
2024-09-13 01:50:53 +00:00
|
|
|
volumes = ["${config.custom.settings.containers.directory}/nextcloud/cache:/data"];
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
db.service = {
|
|
|
|
container_name = "nextcloud-db";
|
2024-09-13 01:50:53 +00:00
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/nextcloud/db.env".path];
|
2024-09-09 00:22:14 +00:00
|
|
|
image = "postgres:15";
|
|
|
|
restart = "unless-stopped";
|
|
|
|
|
|
|
|
volumes = [
|
|
|
|
"${config.custom.settings.containers.directory}/nextcloud/db:/var/lib/postgresql/data"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|