NixOS-Config/nixos/server/package-configs/nextcloud/default.nix

126 lines
3.6 KiB
Nix
Raw Normal View History

2023-11-19 23:20:16 +01:00
{
config,
pkgs,
...
}: {
2023-11-27 14:12:18 +01:00
sops.secrets."nextcloudadmin".mode = "0440";
sops.secrets."nextcloudadmin".owner = config.users.users.nextcloud.name;
sops.secrets."nextclouddb".mode = "0440";
sops.secrets."nextclouddb".owner = config.users.users.nextcloud.name;
2024-12-23 01:32:34 +01:00
# sops.secrets."local.json".mode = "0440";
# sops.secrets."local.json".owner = config.users.users.onlyoffice.name;
2023-11-27 14:12:18 +01:00
users.users = {
2024-12-23 01:32:34 +01:00
# nextcloud.extraGroups = [config.users.groups.keys.name config.users.users.onlyoffice.name];
nextcloud.extraGroups = [config.users.groups.keys.name];
#aria2.extraGroups = ["nextcloud"];
2024-12-23 01:32:34 +01:00
# onlyoffice.extraGroups = [config.users.users.nextcloud.name];
2023-11-27 14:12:18 +01:00
};
2023-11-23 14:55:06 +01:00
# Enable Nginx
services.nginx = {
enable = true;
2023-11-19 23:20:16 +01:00
2023-11-23 14:55:06 +01:00
# Use recommended settings
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
2023-11-19 23:20:16 +01:00
2023-11-23 14:55:06 +01:00
# Only allow PFS-enabled ciphers with AES256
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
2023-11-19 23:20:16 +01:00
2023-11-23 14:55:06 +01:00
# Setup Nextcloud virtual host to listen on ports
virtualHosts = {
"nextcloud.gladtherescake.eu" = {
## Force HTTP redirect to HTTPS
forceSSL = true;
## LetsEncrypt
enableACME = true;
};
"onlyoffice.gladtherescake.eu" = {
2023-11-23 19:24:27 +01:00
forceSSL = true;
enableACME = true;
};
2023-11-23 14:55:06 +01:00
};
2023-11-19 23:20:16 +01:00
};
2023-11-23 14:55:06 +01:00
# Actual Nextcloud Config
2023-11-19 23:20:16 +01:00
services.nextcloud = {
enable = true;
hostName = "nextcloud.gladtherescake.eu";
2023-11-23 14:35:01 +01:00
package = pkgs.nextcloud30;
2023-11-23 15:23:59 +01:00
2023-11-23 14:55:06 +01:00
# Use HTTPS for links
https = true;
2023-11-19 23:20:16 +01:00
2023-11-23 14:55:06 +01:00
# Auto-update Nextcloud Apps
autoUpdateApps.enable = true;
# Set what time makes sense for you
autoUpdateApps.startAt = "05:00:00";
2023-11-23 19:24:27 +01:00
configureRedis = true;
maxUploadSize = "16G";
2023-11-19 23:20:16 +01:00
2023-11-24 17:46:22 +01:00
#Increase opcache string buffer
phpOptions."opcache.interned_strings_buffer" = "23";
2024-01-01 23:31:13 +01:00
# Further forces Nextcloud to use HTTPS
settings = {
2024-01-01 23:31:13 +01:00
overwriteprotocol = "https";
2024-01-10 11:23:58 +01:00
default_phone_region = "NL";
2024-02-08 21:46:24 +01:00
maintenance_window_start = 3;
2024-01-01 23:31:13 +01:00
};
2023-11-27 22:39:59 +01:00
appstoreEnable = true;
extraAppsEnable = true;
2023-12-20 19:32:46 +01:00
#extraApps = with config.services.nextcloud.package.packages.apps; {
2023-12-21 19:22:00 +01:00
# List of apps we want to install and are already packaged in
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/nextcloud/packages/nextcloud-apps.json
# inherit calendar contacts deck forms notes onlyoffice polls twofactor_nextcloud_notification unsplash;
#};
2023-11-23 19:57:25 +01:00
2023-11-23 14:55:06 +01:00
config = {
# Nextcloud PostegreSQL database configuration, recommended over using SQLite
dbtype = "pgsql";
dbuser = "nextcloud";
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
dbname = "nextcloud";
2023-11-23 15:03:46 +01:00
dbpassFile = config.sops.secrets."nextclouddb".path;
2023-11-19 23:20:16 +01:00
2023-11-23 15:03:46 +01:00
adminpassFile = config.sops.secrets."nextcloudadmin".path;
2023-11-23 15:10:34 +01:00
adminuser = "GLaDTheresCake";
2023-11-23 14:35:01 +01:00
};
};
2023-11-21 14:55:19 +01:00
2024-12-23 01:32:34 +01:00
# services.onlyoffice = {
# port = 16783;
# enable = true;
# hostname = "onlyoffice.gladtherescake.eu";
# #postgresHost = "/run/postgesql";
# #postgresUser = "onlyoffice";
# #postgresName = "onlyoffice";
# #jwtSecretFile = config.sops.secrets."local.json".path;
# };
2023-11-23 19:24:27 +01:00
services.rabbitmq = {
enable = true;
};
2023-11-23 15:14:44 +01:00
systemd.services."sops-nix.service" = {
before = [
"nextcloud-setup.service"
"postgresql.service"
"onlyoffice-converter.service"
"onlyoffice-docservice.service"
"nginx.service"
"phpfpm-nextcloud.service"
"redis-nextcloud.service"
];
2023-11-23 15:14:44 +01:00
};
2023-11-23 14:55:06 +01:00
# Ensure that postgres is running before running the setup
systemd.services."nextcloud-setup" = {
requires = ["postgresql.service"];
after = ["postgresql.service"];
2023-11-19 23:20:16 +01:00
};
}