2022-03-10 21:52:12 +01:00
|
|
|
{
|
|
|
|
|
pkgs,
|
2022-05-22 11:47:59 +02:00
|
|
|
config,
|
2022-03-10 21:52:12 +01:00
|
|
|
lib,
|
|
|
|
|
...
|
|
|
|
|
}: let
|
2023-02-22 10:02:55 +01:00
|
|
|
inherit (import ../../lib) localAddresses;
|
2022-03-10 21:52:12 +01:00
|
|
|
in {
|
2023-02-22 10:02:55 +01:00
|
|
|
age.secrets = {
|
|
|
|
|
nextcloud-password-database = {
|
2023-07-04 16:28:26 +02:00
|
|
|
file = ../../secrets/nextcloud-password-database.age;
|
2023-02-22 10:02:55 +01:00
|
|
|
owner = "nextcloud";
|
|
|
|
|
group = "nextcloud";
|
|
|
|
|
mode = "440";
|
|
|
|
|
};
|
|
|
|
|
nextcloud-password-admin = {
|
2023-07-04 16:28:26 +02:00
|
|
|
file = ../../secrets/nextcloud-password-admin.age;
|
2023-02-22 10:02:55 +01:00
|
|
|
owner = "nextcloud";
|
|
|
|
|
group = "nextcloud";
|
|
|
|
|
mode = "440";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-24 13:30:30 +02:00
|
|
|
services.nextcloud = {
|
|
|
|
|
enable = true;
|
2023-06-06 19:59:27 +02:00
|
|
|
package = pkgs.nextcloud26;
|
2020-10-31 20:51:25 +01:00
|
|
|
|
|
|
|
|
https = true;
|
2022-12-03 08:36:29 +01:00
|
|
|
enableBrokenCiphersForSSE = false;
|
2020-10-24 13:30:30 +02:00
|
|
|
|
|
|
|
|
autoUpdateApps = {
|
|
|
|
|
enable = true;
|
|
|
|
|
startAt = "05:00:00";
|
|
|
|
|
};
|
|
|
|
|
|
2023-07-16 08:20:47 +02:00
|
|
|
hostName = "cloud.kmein.de";
|
2020-10-24 13:30:30 +02:00
|
|
|
|
2022-12-01 18:25:33 +01:00
|
|
|
phpOptions."opcache.interned_strings_buffer" = "32"; # buffer size in MB
|
|
|
|
|
|
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";
|
2023-02-22 10:02:55 +01:00
|
|
|
dbpassFile = config.age.secrets.nextcloud-password-database.path;
|
|
|
|
|
adminpassFile = config.age.secrets.nextcloud-password-admin.path;
|
2020-10-24 13:30:30 +02:00
|
|
|
adminuser = "admin";
|
2020-10-31 20:51:25 +01:00
|
|
|
# extraTrustedDomains = [ "toum.r" ];
|
2022-12-01 13:37:46 +01:00
|
|
|
defaultPhoneRegion = "DE";
|
2020-10-24 13:30:30 +02:00
|
|
|
};
|
2022-12-01 13:37:46 +01:00
|
|
|
|
2022-12-01 18:25:33 +01:00
|
|
|
logLevel = 2;
|
2022-12-01 13:37:46 +01:00
|
|
|
|
2022-12-01 18:25:33 +01:00
|
|
|
extraOptions = let
|
2023-02-22 10:02:55 +01:00
|
|
|
inherit (import ../../lib/email.nix {inherit lib;}) cock;
|
2022-12-01 18:25:33 +01:00
|
|
|
address = builtins.split "@" cock.user;
|
|
|
|
|
in {
|
|
|
|
|
defaultapp = "files";
|
|
|
|
|
mail_smtpmode = "smtp";
|
|
|
|
|
mail_sendmailmode = "smtp";
|
|
|
|
|
mail_smtphost = cock.smtp;
|
|
|
|
|
mail_smtpport = "587";
|
|
|
|
|
mail_from_address = builtins.elemAt address 0;
|
|
|
|
|
mail_domain = builtins.elemAt address 2;
|
|
|
|
|
mail_smtpsecure = "tls";
|
|
|
|
|
mail_smtpauthtype = "LOGIN";
|
|
|
|
|
mail_smtpauth = 1;
|
|
|
|
|
mail_smtpname = cock.user;
|
2023-02-22 10:02:55 +01:00
|
|
|
# mail_smtppassword = cock.password; # TODO how to do this?
|
2022-12-01 18:25:33 +01:00
|
|
|
};
|
2020-10-24 13:30:30 +02:00
|
|
|
};
|
|
|
|
|
|
2022-05-22 11:47:59 +02:00
|
|
|
niveum.passport.services = [
|
|
|
|
|
{
|
|
|
|
|
title = "Nextcloud";
|
|
|
|
|
link = "https://${config.services.nextcloud.hostName}";
|
|
|
|
|
description = "manages calendars, to-do lists, files, and recipes.";
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2022-12-03 08:25:47 +01:00
|
|
|
services.postgresqlBackup = {
|
|
|
|
|
enable = true;
|
|
|
|
|
databases = [config.services.nextcloud.config.dbname];
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-24 13:30:30 +02:00
|
|
|
services.postgresql = {
|
|
|
|
|
enable = true;
|
2022-12-03 08:25:47 +01:00
|
|
|
ensureDatabases = [config.services.nextcloud.config.dbname];
|
2020-10-24 13:30:30 +02:00
|
|
|
ensureUsers = [
|
|
|
|
|
{
|
|
|
|
|
name = "nextcloud";
|
2022-12-03 08:25:47 +01:00
|
|
|
ensurePermissions."DATABASE ${config.services.nextcloud.config.dbname}" = "ALL PRIVILEGES";
|
2020-10-24 13:30:30 +02:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2023-07-16 08:20:47 +02:00
|
|
|
services.nginx.virtualHosts."cloud.kmein.de" = {
|
2020-10-31 20:51:25 +01:00
|
|
|
enableACME = true;
|
2021-01-15 14:08:45 +01:00
|
|
|
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"];
|
|
|
|
|
};
|
|
|
|
|
}
|