Refactor server files
This commit is contained in:
parent
c3f87354a9
commit
0a78188848
21 changed files with 90 additions and 111 deletions
97
servers/nextcloud.nix
Normal file
97
servers/nextcloud.nix
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ./cert-store-client.nix ];
|
||||
|
||||
options.custom = {
|
||||
nextcloud_domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Domain used by Nextcloud";
|
||||
};
|
||||
|
||||
collabora_domain = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
description = "Domain used by Collabora Online";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
services = {
|
||||
nextcloud = {
|
||||
package = pkgs.nextcloud31;
|
||||
enable = true;
|
||||
hostName = config.custom.nextcloud_domain;
|
||||
autoUpdateApps.enable = true;
|
||||
https = true;
|
||||
maxUploadSize = "512M"; # Default
|
||||
config = {
|
||||
dbtype = "sqlite";
|
||||
adminpassFile = "/var/lib/nextcloud/adminpass";
|
||||
};
|
||||
settings = {
|
||||
overwriteprotocol = "https";
|
||||
default_phone_region = "FI";
|
||||
maintenance_window_start = 1;
|
||||
};
|
||||
phpOptions = {
|
||||
"opcache.interned_strings_buffer" = 32;
|
||||
};
|
||||
};
|
||||
|
||||
nginx.virtualHosts.${config.services.nextcloud.hostName} = { };
|
||||
};
|
||||
}
|
||||
(
|
||||
# Optional Collabora Client
|
||||
lib.mkIf (config.custom.collabora_domain != null) {
|
||||
services = {
|
||||
collabora-online = {
|
||||
enable = true;
|
||||
port = 9980; # default
|
||||
settings = {
|
||||
ssl = {
|
||||
enable = false;
|
||||
termination = true;
|
||||
};
|
||||
|
||||
net = {
|
||||
listen = "loopback";
|
||||
post_allow.host = [ "::1" ];
|
||||
};
|
||||
|
||||
storage.wopi = {
|
||||
"@allow" = true;
|
||||
host = [ config.services.nextcloud.hostName ] ++ config.services.nextcloud.settings.trusted_domains;
|
||||
};
|
||||
|
||||
server_name = config.custom.collabora_domain;
|
||||
};
|
||||
};
|
||||
|
||||
nginx.virtualHosts.${config.services.collabora-online.settings.server_name} = {
|
||||
locations."/" = {
|
||||
proxyPass = "http://[::1]:${toString config.services.collabora-online.port}";
|
||||
proxyWebsockets = true; # collabora uses websockets
|
||||
};
|
||||
};
|
||||
|
||||
nextcloud = {
|
||||
appstoreEnable = true;
|
||||
extraAppsEnable = true;
|
||||
extraApps = with config.services.nextcloud.package.packages.apps; {
|
||||
inherit
|
||||
richdocuments
|
||||
;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue