nixos/hosts/architect/nextcloud.nix

101 lines
2.0 KiB
Nix
Raw Normal View History

{ pkgs, config, lib, ... }:
2021-07-13 09:53:22 +01:00
let
domain = "cloud.giugl.io";
2022-10-28 12:32:49 +01:00
redis_port = 6379;
utilities = import ./utilities.nix { inherit lib config; };
inherit (utilities) architectInterfaceAddress;
2023-02-11 02:29:48 +00:00
in
{
age.secrets = {
nextcloud-admin = {
file = ../../secrets/nextcloud-admin.age;
owner = "nextcloud";
group ="nginx";
};
nextcloud-database = {
file = ../../secrets/nextcloud-database.age;
owner = "nextcloud";
group = "nginx";
};
};
environment.systemPackages = with pkgs; [
nodejs-18_x
libtensorflow
ffmpeg
];
2021-07-13 09:53:22 +01:00
services = {
nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
2023-06-26 22:24:04 +01:00
extraConfig = ''
aio threads;
directio 1M;
output_buffers 3 1M;
sendfile on;
sendfile_max_chunk 0;
autoindex on;
'';
};
2022-10-28 12:32:49 +01:00
mysql = {
enable = true;
package = pkgs.mariadb_1011;
2022-10-28 12:32:49 +01:00
};
2021-11-25 11:42:32 +00:00
2022-10-28 12:32:49 +01:00
redis = {
vmOverCommit = true;
servers."nextcloud" = {
enable = true;
port = redis_port;
};
};
2021-07-13 09:53:22 +01:00
nextcloud = {
enable = true;
2022-10-28 12:32:49 +01:00
hostName = domain;
2021-07-13 09:53:22 +01:00
https = true;
package = pkgs.nextcloud30;
2022-12-01 13:28:10 +00:00
datadir = "/services/nextcloud";
configureRedis = true;
2022-10-28 12:32:49 +01:00
caching = {
redis = true;
};
2021-07-13 09:53:22 +01:00
autoUpdateApps.enable = true;
autoUpdateApps.startAt = "05:00:00";
maxUploadSize = "50G";
2024-06-01 11:41:26 +01:00
settings = {
overwriteprotocol = "https";
};
2021-07-13 09:53:22 +01:00
config = {
dbtype = "mysql";
dbuser = "nextcloud";
2021-07-13 09:53:22 +01:00
dbhost = "localhost";
dbname = "nextcloud";
dbpassFile = config.age.secrets.nextcloud-database.path;
adminpassFile = config.age.secrets.nextcloud-admin.path;
2021-07-13 09:53:22 +01:00
};
};
};
systemd.services."nextcloud-setup" = {
2021-11-25 11:42:32 +00:00
requires = [ "mysql.service" ];
after = [ "mysql.service" ];
2021-07-13 09:53:22 +01:00
};
networking.extraHosts = ''
${architectInterfaceAddress "lan"} ${domain}
${architectInterfaceAddress "tailscale"} ${domain}
2021-07-13 09:53:22 +01:00
'';
}