1
1
Fork 0
nixos/options/custom/settings/containers/nextcloud.nix
Myned 53c8575116
git: migrate to forgejo
Squashes 1,331 commits

Signed-off-by: Myned <dev@bjork.tech>
2024-09-12 19:41:21 -05:00

88 lines
2.5 KiB
Nix

{
config,
inputs,
lib,
...
}:
with lib;
let
cfg = config.custom.settings.containers.nextcloud;
in
{
options.custom.settings.containers.nextcloud.enable = mkOption { default = false; };
config = mkIf cfg.enable {
age.secrets =
let
secret = filename: {
file = "${inputs.self}/secrets/${filename}";
};
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";
};
#?? 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";
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";
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";
volumes = [ "${config.custom.settings.containers.directory}/nextcloud/cache:/data" ];
};
db.service = {
container_name = "nextcloud-db";
env_file = [ config.age.secrets."${config.custom.profile}/nextcloud/db.env".path ];
image = "postgres:15";
restart = "unless-stopped";
volumes = [
"${config.custom.settings.containers.directory}/nextcloud/db:/var/lib/postgresql/data"
];
};
};
};
};
}