2020-03-03 18:45:35 +01:00
|
|
|
{ pkgs, ... }: {
|
2020-03-03 20:09:31 +01:00
|
|
|
|
|
|
|
# setup nextcloud in a container
|
|
|
|
containers.nextcloud = {
|
|
|
|
bindMounts = {
|
|
|
|
password = {
|
|
|
|
hostPath = toString <secrets/nextcloud/rootpassword>;
|
|
|
|
mountPoint = toString <secrets/nextcloud/rootpassword>;
|
|
|
|
isReadOnly = true;
|
|
|
|
};
|
|
|
|
home = {
|
|
|
|
hostPath = toString "/home/nextcloud";
|
|
|
|
mountPoint = "/var/lib/nextcloud";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress = "192.168.100.10";
|
|
|
|
localAddress = "192.168.100.11";
|
|
|
|
|
|
|
|
autoStart = true;
|
|
|
|
|
|
|
|
config = { config, pkgs, ... }: {
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
|
|
networking.firewall.allowedUDPPorts = [ 80 ];
|
|
|
|
|
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
autoUpdateApps.enable = true;
|
|
|
|
config.adminpassFile = toString <secrets/nextcloud/rootpassword>;
|
|
|
|
nginx.enable = true;
|
|
|
|
hostName = "nextcloud.workhorse.private";
|
|
|
|
logLevel = 0;
|
|
|
|
config.extraTrustedDomains = [
|
|
|
|
"nextcloud.ingolf-wagner.de"
|
|
|
|
"nextcloud.gaykraft.com"
|
|
|
|
"192.168.100.11"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.smbclient ];
|
|
|
|
};
|
2020-03-03 17:14:21 +01:00
|
|
|
};
|
2020-03-03 18:45:35 +01:00
|
|
|
|
2020-03-03 23:20:34 +01:00
|
|
|
# give containers internet access
|
|
|
|
networking.nat.enable = true;
|
|
|
|
networking.nat.internalInterfaces = [ "ve-nextcloud" ];
|
|
|
|
networking.nat.externalInterface = "eth0";
|
|
|
|
|
|
|
|
# don't let networkmanager manger container network
|
|
|
|
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
|
|
|
|
|
2020-03-03 20:09:31 +01:00
|
|
|
# host nginx setup
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
2020-03-04 07:37:03 +01:00
|
|
|
recommendedProxySettings = true;
|
2020-03-03 20:09:31 +01:00
|
|
|
virtualHosts = {
|
|
|
|
"nextcloud.workhorse.private" = {
|
2020-03-04 07:37:03 +01:00
|
|
|
serverAliases =
|
|
|
|
[ "nextcloud.ingolf-wagner.de" "nextcloud.gaykraft.com" ];
|
2020-03-03 20:09:31 +01:00
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://192.168.100.11";
|
|
|
|
extraConfig = ''
|
2020-03-04 07:37:03 +01:00
|
|
|
|
|
|
|
# rewrite response bodies
|
|
|
|
# -----------------------
|
2020-03-03 20:09:31 +01:00
|
|
|
sub_filter "192.168.100.11" "nextcloud.workhorse.private";
|
2020-03-04 07:37:03 +01:00
|
|
|
|
|
|
|
# rewrite redirects
|
|
|
|
# -----------------
|
|
|
|
#proxy_redirect http://192.168.100.11:80/ http://$host:$server_port/;
|
|
|
|
#proxy_redirect 192.168.100.11 nextcloud.workhorse.private;
|
|
|
|
|
|
|
|
# allow big uploads
|
|
|
|
# -----------------
|
2020-03-03 20:09:31 +01:00
|
|
|
client_max_body_size 0;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2020-03-03 18:45:35 +01:00
|
|
|
|
2020-03-03 17:14:21 +01:00
|
|
|
}
|