nix-config/nixos/_mixins/services/nextcloud.nix
2024-05-23 15:02:20 -04:00

56 lines
1.7 KiB
Nix

# Reference: https://carjorvaz.com/posts/the-holy-grail-nextcloud-setup-made-easy-by-nixos/
{ config, lib, pkgs, ... }:
let
fqdn = "onlyoffice.${config.domainName}";
in
{
services = {
nginx.virtualHosts."${fqdn}" = {
forceSSL = true;
enableACME = true;
};
nextcloud = {
enable = true;
hostName = fqdn;
# Need to manually increment with every major upgrade.
package = pkgs.nextcloud28;
# Let NixOS install and configure the database automatically.
database.createLocally = true;
# Let NixOS install and configure Redis caching automatically.
configureRedis = true;
# Increase the maximum file upload size to avoid problems uploading videos.
maxUploadSize = lib.mkDefault "16G";
https = true;
enableBrokenCiphersForSSE = false;
autoUpdateApps.enable = true;
extraAppsEnable = true;
extraApps = with config.services.nextcloud.package.packages.apps; {
# List of apps we want to install and are already packaged in
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/nextcloud/packages/nextcloud-apps.json
inherit calendar contacts mail notes onlyoffice tasks;
# Custom app installation example.
# cookbook = pkgs.fetchNextcloudApp rec {
# url =
# "https://github.com/nextcloud/cookbook/releases/download/v0.10.2/Cookbook-0.10.2.tar.gz";
# sha256 = "sha256-XgBwUr26qW6wvqhrnhhhhcN4wkI+eXDHnNSm1HDbP6M=";
# };
};
config = {
overwriteProtocol = "https";
defaultPhoneRegion = "PT";
dbtype = "pgsql";
adminuser = "admin";
adminpassFile = "/path/to/nextcloud-admin-pass";
};
};
};
}