nixos/hosts/hub/apps/nextcloud.nix

91 lines
2.5 KiB
Nix
Raw Normal View History

2024-12-18 18:19:37 -06:00
{
services.postgresql = {
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{
name = "nextcloud";
ensureDBOwnership = true;
}
];
};
containers.nextcloud = {
autoStart = true;
privateNetwork = true;
hostAddress = "192.168.0.1";
localAddress = "192.168.0.3";
config =
{
config,
pkgs,
lib,
...
}:
{
environment.etc."nextcloud-admin-pass".text = "admin";
nixpkgs.config.allowUnfree = true;
services = {
nextcloud = {
enable = true;
hostName = "nextcloud.thewordnerd.info";
package = pkgs.nextcloud30;
configureRedis = true;
maxUploadSize = "16G";
2024-12-23 11:20:27 -06:00
# autoUpdateApps.enable = true;
2025-02-14 13:01:44 -06:00
notify_push = {
enable = true;
bendDomainToLocalhost = true;
};
2024-12-18 18:19:37 -06:00
webfinger = true;
settings = {
overwriteprotocol = "https";
2025-02-14 13:01:44 -06:00
trusted_proxies = [
"192.168.0.1"
];
2024-12-18 18:19:37 -06:00
default_phone_region = "US";
2025-02-14 13:01:44 -06:00
# loglevel = 0;
2024-12-18 18:19:37 -06:00
};
config = {
dbtype = "pgsql";
dbhost = "/run/postgresql";
adminpassFile = "/etc/nextcloud-admin-pass";
};
2024-12-23 11:20:27 -06:00
phpOptions."opcache.interned_strings_buffer" = "23";
2024-12-18 18:19:37 -06:00
};
resolved.enable = true;
};
2024-12-23 11:20:27 -06:00
programs.nix-ld.enable = true;
2024-12-18 18:19:37 -06:00
networking = {
firewall.allowedTCPPorts = [ 80 ];
useHostResolvConf = lib.mkForce false;
};
2025-02-14 13:01:44 -06:00
virtualisation.docker.enable = true;
users.users.nextcloud.extraGroups = [ "docker" ];
environment.systemPackages = [
(pkgs.writeScriptBin "occ" ''
#!${pkgs.bash}/bin/bash
exec nextcloud-occ "$@"
'')
];
2024-12-18 18:19:37 -06:00
};
2025-02-14 13:01:44 -06:00
# https://discourse.nixos.org/t/podman-docker-in-nixos-container-ideally-in-unprivileged-one/22909/12
additionalCapabilities = [
''all" --system-call-filter="add_key keyctl bpf" --capability="all''
];
2024-12-18 18:19:37 -06:00
bindMounts = {
2024-12-23 11:20:27 -06:00
"/run/postgresql" = {
hostPath = "/run/postgresql";
2024-12-18 18:19:37 -06:00
};
};
};
2024-12-23 11:20:27 -06:00
services.caddy.virtualHosts."nextcloud.thewordnerd.info".extraConfig = ''
reverse_proxy nextcloud
header Strict-Transport-Security max-age=31536000;
'';
2025-02-14 13:01:44 -06:00
services.caddy.virtualHosts."collabora.thewordnerd.info".extraConfig = ''
reverse_proxy nextcloud:9980
'';
2024-12-18 18:19:37 -06:00
}