{ pkgs, ...}@all: with all;
{
  sops.secrets = { 
    "nx2site/nextcloud/admin-pass" = { owner = "nextcloud"; };
    "nx2site/nextcloud/db-pass" = { owner = "nextcloud"; };
    # "nx2site/nextcloud/users-pass/nx2" = { owner = "nextcloud"; };
  };

  services = {
    nextcloud = {
      enable = true;
      package = pkgs.nextcloud;
      hostName = "nc.${hyper.domain}";
      https = true;
      configureRedis = true;
      config = {
        adminpassFile = config.sops.secrets."nx2site/nextcloud/admin-pass".path;
        adminuser = "nx2";

        dbtype = "pgsql";
        # dbhost = config.services.postgresql.settings.port; # using usix socket
        dbname = "nextcloud";
        dbpassFile = config.sops.secrets."nx2site/nextcloud/db-pass".path;
      };
    };
  };
}
