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

123 lines
2.9 KiB
Nix
Raw Normal View History

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
...
2025-12-28 13:39:42 +01:00
}:
let
storageBoxMountPoint = "/mnt/storagebox";
2025-12-28 13:39:42 +01:00
in
{
# https://docs.hetzner.com/de/robot/storage-box/access/access-samba-cifs/
fileSystems.${storageBoxMountPoint} = {
device = "//u359050.your-storagebox.de/backup";
fsType = "cifs";
options = [
"iocharset=utf8"
"rw"
"credentials=${config.age.secrets.hetzner-storagebox-credentials.path}"
"uid=nextcloud"
"gid=nextcloud"
"file_mode=0660"
"dir_mode=0770"
"seal"
"mfsymlinks" # nextcloud-setup wants to create symlinks on cifs
];
};
systemd.services.nextcloud-setup = {
2025-12-28 13:39:42 +01:00
wants = [
"mnt-storagebox.mount"
"postgresql.service"
];
after = [
"mnt-storagebox.mount"
"postgresql.service"
];
};
age.secrets = {
hetzner-storagebox-credentials = {
file = ../../secrets/hetzner-storagebox-credentials.age;
};
nextcloud-password-database = {
file = ../../secrets/nextcloud-password-database.age;
owner = "nextcloud";
group = "nextcloud";
mode = "440";
};
nextcloud-password-admin = {
file = ../../secrets/nextcloud-password-admin.age;
owner = "nextcloud";
group = "nextcloud";
mode = "440";
};
};
2020-10-24 13:30:30 +02:00
services.nextcloud = {
enable = true;
2026-02-17 20:12:40 +01:00
package = pkgs.nextcloud32;
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";
};
2023-07-16 08:20:47 +02:00
hostName = "cloud.kmein.de";
2020-10-24 13:30:30 +02:00
2024-12-02 13:12:24 +01:00
home = "${storageBoxMountPoint}/nextcloud";
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 = {
dbtype = "pgsql";
dbuser = "nextcloud";
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
dbname = "nextcloud";
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" ];
2020-10-24 13:30:30 +02:00
};
2022-12-01 13:37:46 +01:00
2024-11-09 16:57:16 +01:00
settings = {
2022-12-01 18:25:33 +01:00
defaultapp = "files";
2024-11-09 16:57:16 +01:00
overwriteprotocol = "https";
default_phone_region = "DE";
log_level = 2;
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;
2025-12-28 13:39:42 +01:00
databases = [ config.services.nextcloud.config.dbname ];
2022-12-03 08:25:47 +01:00
};
2020-10-24 13:30:30 +02:00
services.postgresql = {
enable = true;
2025-12-28 13:39:42 +01:00
ensureDatabases = [ config.services.nextcloud.config.dbname ];
2020-10-24 13:30:30 +02:00
ensureUsers = [
{
name = "nextcloud";
2023-12-06 14:41:49 +01:00
ensureDBOwnership = true;
# ensurePermissions."DATABASE ${config.services.nextcloud.config.dbname}" = "ALL PRIVILEGES";
2020-10-24 13:30:30 +02:00
}
];
2023-12-06 14:41:49 +01:00
package = pkgs.postgresql_14;
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;
forceSSL = true;
2020-10-31 20:51:25 +01:00
};
2020-10-24 13:30:30 +02:00
}