{ lib, pkgs, config, ... }: with lib; let cfg = config.nas-apps.nextcloud; in { options.nas-apps.nextcloud = { enable = mkEnableOption "nextcloud docker service"; autoStart = mkOption { type = types.bool; default = true; }; httpPort = mkOption { type = types.str; default = "80"; }; httpsPort = mkOption { type = types.str; default = "443"; }; name = mkOption { type = types.str; default = "nextcloud"; }; image = mkOption { type = types.str; default = "linuxserver/nextcloud"; }; configPath = mkOption { type = types.str; default = "/mnt/ssd/ssd_app_data/nextcloud"; }; dataPath = mkOption { type = types.str; default = "/mnt/mainpool/Nextcloud"; }; puid = mkOption { type = types.str; default = "911"; }; pgid = mkOption { type = types.str; default = "1000"; }; timeZone = mkOption { type = types.str; default = "America/Chicago"; }; }; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { autoStart = cfg.autoStart; image = cfg.image; ports = [ "${cfg.httpPort}:80" "${cfg.httpsPort}:443" ]; volumes = [ "${cfg.configPath}:/config" "${cfg.dataPath}:/data" ]; environment = { PUID = cfg.puid; PGID = cfg.pgid; TZ = cfg.timeZone; }; }; }; }