nextcloud
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
@@ -11,26 +12,97 @@ let
|
||||
|
||||
nextcloudConfig = lib.${namespace}.mkModule {
|
||||
inherit config name;
|
||||
serviceName = "podman-${name}";
|
||||
description = "nextcloud";
|
||||
serviceName = "nextcloud";
|
||||
description = "Nextcloud - Secure file sync and sharing platform";
|
||||
options = { };
|
||||
|
||||
moduleConfig = {
|
||||
virtualisation.oci-containers.containers."${name}" = {
|
||||
autoStart = true;
|
||||
image = "lscr.io/linuxserver/nextcloud";
|
||||
ports = [
|
||||
"${toString cfg.port}:443"
|
||||
];
|
||||
volumes = [
|
||||
"${cfg.configDir}/nextcloud:/config"
|
||||
"${cfg.dataDir}/nextcloud:/data"
|
||||
"/run/postgresql:/run/postgresql"
|
||||
];
|
||||
environmentFiles = [ ];
|
||||
environment = {
|
||||
PUID = cfg.puid;
|
||||
PGID = cfg.pgid;
|
||||
TZ = cfg.timeZone;
|
||||
# Setup the native NixOS Nextcloud service
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
package = pkgs.nextcloud32;
|
||||
hostName = "cloud.mjallen.dev";
|
||||
home = "${cfg.configDir}/nextcloud";
|
||||
datadir = "${cfg.dataDir}/nextcloud";
|
||||
configureRedis = true;
|
||||
enableImagemagick = true;
|
||||
appstoreEnable = true;
|
||||
|
||||
# Use PostgreSQL for database
|
||||
config = {
|
||||
dbtype = "pgsql";
|
||||
dbname = "nextcloud";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "/run/postgresql"; # Socket directory
|
||||
# dbpassFile = config.sops.secrets."jallen-nas/nextcloud/dbpassword".path;
|
||||
adminuser = "mjallen";
|
||||
adminpassFile = config.sops.secrets."matt_password".path;
|
||||
};
|
||||
|
||||
# PHP settings
|
||||
phpOptions = lib.mkOverride 90 {
|
||||
memory_limit = "512M";
|
||||
upload_max_filesize = "10G";
|
||||
post_max_size = "10G";
|
||||
output_buffering = "0";
|
||||
"opcache.interned_strings_buffer" = "16";
|
||||
"opcache.max_accelerated_files" = "10000";
|
||||
"opcache.memory_consumption" = "128";
|
||||
"opcache.save_comments" = "1";
|
||||
"opcache.revalidate_freq" = "1";
|
||||
};
|
||||
|
||||
# Configure caching for better performance
|
||||
caching = {
|
||||
apcu = true;
|
||||
redis = true;
|
||||
memcached = false;
|
||||
};
|
||||
|
||||
# Auto-update apps
|
||||
autoUpdateApps = {
|
||||
enable = false;
|
||||
startAt = "05:00:00";
|
||||
};
|
||||
|
||||
# Configure HTTPS if enabled
|
||||
https = false;
|
||||
|
||||
settings = {
|
||||
default_phone_region = "US";
|
||||
trusted_proxies = [ "10.0.1.3" ];
|
||||
trusted_domains = [
|
||||
"cloud.mjallen.dev"
|
||||
"10.0.1.3:${toString cfg.port}"
|
||||
];
|
||||
enabledPreviewProviders = [
|
||||
"OC\\Preview\\PNG"
|
||||
"OC\\Preview\\JPEG"
|
||||
"OC\\Preview\\GIF"
|
||||
"OC\\Preview\\BMP"
|
||||
"OC\\Preview\\XBitmap"
|
||||
"OC\\Preview\\Krita"
|
||||
"OC\\Preview\\WebP"
|
||||
"OC\\Preview\\MarkDown"
|
||||
"OC\\Preview\\TXT"
|
||||
"OC\\Preview\\OpenDocument"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
users.users.nextcloud.isSystemUser = lib.mkForce true;
|
||||
users.users.nextcloud.isNormalUser = lib.mkForce false;
|
||||
users.groups.nextcloud = {};
|
||||
|
||||
# Configure web server
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts.${config.services.nextcloud.hostName} = {
|
||||
listen = [{
|
||||
addr = "0.0.0.0";
|
||||
port = cfg.port;
|
||||
ssl = false;
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -38,4 +110,4 @@ let
|
||||
in
|
||||
{
|
||||
imports = [ nextcloudConfig ];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user