2023-10-22 13:27:42 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.services.skynet_nextcloud;
|
|
|
|
domain = "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}";
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
./acme.nix
|
|
|
|
./dns.nix
|
|
|
|
./nginx.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
options.services.skynet_nextcloud = {
|
|
|
|
enable = mkEnableOption "Skynet Nextcloud";
|
|
|
|
|
|
|
|
host = {
|
|
|
|
ip = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
domain = {
|
|
|
|
tld = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "ie";
|
|
|
|
};
|
|
|
|
|
|
|
|
base = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "skynet";
|
|
|
|
};
|
|
|
|
|
|
|
|
sub = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "nextcloud";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
# shove the entire config file into secrets
|
|
|
|
|
|
|
|
age.secrets.nextcloud_admin_pass = {
|
|
|
|
file = ../secrets/nextcloud/pw.age;
|
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
};
|
|
|
|
|
|
|
|
skynet_acme.domains = [
|
|
|
|
domain
|
2023-10-27 00:54:41 +00:00
|
|
|
"onlyoffice.${domain}"
|
2023-10-22 13:27:42 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
skynet_dns.records = [
|
|
|
|
{
|
|
|
|
record = cfg.domain.sub;
|
|
|
|
r_type = "CNAME";
|
|
|
|
value = cfg.host.name;
|
|
|
|
}
|
2023-10-27 00:54:41 +00:00
|
|
|
{
|
|
|
|
record = "onlyoffice.${cfg.domain.sub}";
|
|
|
|
r_type = "CNAME";
|
|
|
|
value = cfg.host.name;
|
|
|
|
}
|
2023-10-22 13:27:42 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# /var/lib/nextcloud/data
|
|
|
|
|
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.nextcloud27;
|
|
|
|
hostName = domain;
|
|
|
|
https = true;
|
|
|
|
|
2023-10-26 16:38:32 +00:00
|
|
|
configureRedis = true;
|
|
|
|
|
2023-10-26 16:38:15 +00:00
|
|
|
database.createLocally = true;
|
2023-10-22 13:27:42 +00:00
|
|
|
config = {
|
2023-10-26 16:38:15 +00:00
|
|
|
dbtype = "pgsql";
|
|
|
|
defaultPhoneRegion = "IE";
|
2023-10-22 13:27:42 +00:00
|
|
|
trustedProxies = ["193.1.99.65"];
|
|
|
|
adminpassFile = config.age.secrets.nextcloud_admin_pass.path;
|
|
|
|
};
|
|
|
|
|
2023-11-03 23:50:17 +00:00
|
|
|
appstoreEnable = true;
|
|
|
|
|
2023-10-22 13:27:42 +00:00
|
|
|
extraApps = with config.services.nextcloud.package.packages.apps; {
|
|
|
|
inherit files_markdown files_texteditor forms groupfolders mail maps news notes onlyoffice polls;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraOptions = {
|
|
|
|
mail_smtpmode = "sendmail";
|
|
|
|
mail_sendmailmode = "pipe";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-10-27 00:54:41 +00:00
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
services.onlyoffice = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
${domain} = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
|
|
|
};
|
|
|
|
"onlyoffice.${domain}" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "skynet";
|
|
|
|
locations."/".proxyPass = "http://127.0.0.1:8000";
|
|
|
|
};
|
2023-10-22 13:27:42 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|