1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/nextcloud.nix

57 lines
1.3 KiB
Nix
Raw Normal View History

2020-10-24 13:30:30 +02:00
{ pkgs, lib, ... }:
let
passwordFile = path: toString (pkgs.writeText "password" (lib.strings.fileContents path));
2020-10-24 13:30:30 +02:00
inherit (import <niveum/lib>) localAddresses;
in
{
services.nextcloud = {
enable = true;
2021-10-08 20:25:54 +02:00
package = pkgs.nextcloud22;
2020-10-31 20:51:25 +01:00
https = true;
2020-10-24 13:30:30 +02:00
autoUpdateApps = {
enable = true;
startAt = "05:00:00";
};
hostName = "cloud.kmein.de";
2020-10-24 13:30:30 +02:00
config = {
2020-10-31 20:51:25 +01:00
overwriteProtocol = "https";
2020-10-24 13:30:30 +02:00
dbtype = "pgsql";
dbuser = "nextcloud";
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
dbname = "nextcloud";
dbpassFile = passwordFile <system-secrets/nextcloud/database>;
adminpassFile = passwordFile <system-secrets/nextcloud/admin>;
2020-10-24 13:30:30 +02:00
adminuser = "admin";
2020-10-31 20:51:25 +01:00
# extraTrustedDomains = [ "toum.r" ];
2020-10-24 13:30:30 +02:00
};
};
services.postgresql = {
enable = true;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{
name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
}
];
};
2020-10-31 20:51:25 +01:00
services.nginx.virtualHosts."cloud.kmein.de" = {
2020-10-31 20:51:25 +01:00
enableACME = true;
forceSSL = true;
2020-10-31 20:51:25 +01:00
};
2020-10-24 13:30:30 +02:00
# Ensure that postgres is running before running the setup
systemd.services."nextcloud-setup" = {
requires = ["postgresql.service"];
after = ["postgresql.service"];
};
}