katzen-cafe/modules/containers/nextcloud.nix

70 lines
1.9 KiB
Nix
Raw Permalink Normal View History

2023-12-09 22:06:23 +01:00
{pkgs, ...}: {
2023-08-05 18:46:25 +02:00
containers."nextcloud" = {
autoStart = true;
privateNetwork = true;
hostAddress = "10.0.3.1";
localAddress = "10.0.3.2";
bindMounts = {
"/var/lib/nextcloud" = {
hostPath = "/nextcloud/data";
isReadOnly = false;
};
"/var/lib/postgresql" = {
hostPath = "/nextcloud/db";
isReadOnly = false;
};
"/var/secret" = {
hostPath = "/nextcloud/secret";
isReadOnly = true;
};
};
2023-12-09 22:06:23 +01:00
config = {
config,
pkgs,
...
}: {
2023-08-05 18:46:25 +02:00
networking.firewall.enable = false;
2023-12-09 22:06:23 +01:00
environment.etc."resolv.conf".text = "nameserver 9.9.9.9";
2023-08-05 18:46:25 +02:00
services.nextcloud = {
enable = true;
https = true;
config = {
dbtype = "pgsql";
dbhost = "/run/postgresql";
adminpassFile = "/var/secret/nextcloud-admin-pass";
2023-12-09 22:06:23 +01:00
trustedProxies = ["10.0.3.1"];
2023-08-05 18:46:25 +02:00
};
hostName = "wolke.katzen.cafe";
2024-07-29 18:44:41 +02:00
package = pkgs.nextcloud29;
2023-08-05 18:46:25 +02:00
extraApps = with config.services.nextcloud.package.packages.apps; {
inherit bookmarks calendar contacts;
2023-12-09 22:06:23 +01:00
user_oidc = pkgs.fetchNextcloudApp rec {
2024-07-29 18:44:41 +02:00
url = "https://github.com/nextcloud-releases/user_oidc/releases/download/v5.0.3/user_oidc-v5.0.3.tar.gz";
sha256 = "sha256-oaN4nYIKzP7r9pB/6szZnkR+liSMARd3Nb8aM3m9WeE=";
license = "gpl3";
2023-12-09 22:06:23 +01:00
};
2023-08-05 18:46:25 +02:00
};
};
services.postgresql = {
enable = true;
2023-12-09 22:06:23 +01:00
ensureDatabases = ["nextcloud"];
2023-08-05 18:46:25 +02:00
ensureUsers = [
{
name = "nextcloud";
2024-07-29 18:44:41 +02:00
# ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
ensureDBOwnership = true;
2023-08-05 18:46:25 +02:00
}
];
};
system.stateVersion = "23.05";
};
};
deployment.keys = {
"nextcloud-admin-pass" = {
2023-12-09 22:06:23 +01:00
keyCommand = ["pass" "nextcloud/admin-password"];
2023-08-05 18:46:25 +02:00
destDir = "/nextcloud/secret";
permissions = "0604";
};
};
2023-12-09 22:06:23 +01:00
}