2023-10-22 13:27:42 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2024-05-30 13:59:20 +00:00
|
|
|
name = "nextcloud";
|
|
|
|
cfg = config.services.skynet."${name}";
|
2023-10-22 13:27:42 +00:00
|
|
|
domain = "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}";
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
];
|
|
|
|
|
2024-05-30 13:59:20 +00:00
|
|
|
options.services.skynet."${name}" = {
|
2023-10-22 13:27:42 +00:00
|
|
|
enable = mkEnableOption "Skynet Nextcloud";
|
|
|
|
|
|
|
|
domain = {
|
|
|
|
tld = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "ie";
|
|
|
|
};
|
|
|
|
|
|
|
|
base = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "skynet";
|
|
|
|
};
|
|
|
|
|
|
|
|
sub = mkOption {
|
|
|
|
type = types.str;
|
2024-05-30 13:59:20 +00:00
|
|
|
default = name;
|
2023-10-22 13:27:42 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
|
2024-05-30 12:34:59 +00:00
|
|
|
services.skynet.acme.domains = [
|
2023-10-22 13:27:42 +00:00
|
|
|
domain
|
2023-10-27 00:54:41 +00:00
|
|
|
"onlyoffice.${domain}"
|
2024-11-01 23:16:45 +00:00
|
|
|
"whiteboard.${domain}"
|
2023-10-22 13:27:42 +00:00
|
|
|
];
|
|
|
|
|
2024-05-30 12:25:52 +00:00
|
|
|
services.skynet.dns.records = [
|
2023-10-22 13:27:42 +00:00
|
|
|
{
|
|
|
|
record = cfg.domain.sub;
|
|
|
|
r_type = "CNAME";
|
2024-05-30 16:55:29 +00:00
|
|
|
value = config.services.skynet.host.name;
|
2023-10-22 13:27:42 +00:00
|
|
|
}
|
2023-10-27 00:54:41 +00:00
|
|
|
{
|
|
|
|
record = "onlyoffice.${cfg.domain.sub}";
|
|
|
|
r_type = "CNAME";
|
2024-05-30 16:55:29 +00:00
|
|
|
value = config.services.skynet.host.name;
|
2023-10-27 00:54:41 +00:00
|
|
|
}
|
2024-11-01 23:16:45 +00:00
|
|
|
# {
|
|
|
|
# record = "whiteboard.${cfg.domain.sub}";
|
|
|
|
# r_type = "CNAME";
|
|
|
|
# value = config.services.skynet.host.name;
|
|
|
|
# }
|
2023-10-22 13:27:42 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# /var/lib/nextcloud/data
|
|
|
|
|
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
2024-11-01 23:16:45 +00:00
|
|
|
package = pkgs.nextcloud30;
|
2023-10-22 13:27:42 +00:00
|
|
|
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";
|
2023-10-22 13:27:42 +00:00
|
|
|
adminpassFile = config.age.secrets.nextcloud_admin_pass.path;
|
|
|
|
};
|
|
|
|
|
2023-11-03 23:50:17 +00:00
|
|
|
appstoreEnable = true;
|
|
|
|
|
2024-11-01 23:16:45 +00:00
|
|
|
extraApps = {
|
|
|
|
inherit (config.services.nextcloud.package.packages.apps) richdocuments;
|
2023-10-22 13:27:42 +00:00
|
|
|
};
|
|
|
|
|
2024-02-09 12:47:20 +00:00
|
|
|
settings = {
|
2024-01-12 21:37:06 +00:00
|
|
|
trusted_proxies = ["193.1.99.65"];
|
|
|
|
default_phone_region = "IE";
|
2023-10-22 13:27:42 +00:00
|
|
|
mail_smtpmode = "sendmail";
|
|
|
|
mail_sendmailmode = "pipe";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-11-01 23:16:45 +00:00
|
|
|
# environment.etc."nextcloud-whiteboard-secret".text = ''
|
|
|
|
# JWT_SECRET_KEY=test123
|
|
|
|
# '';
|
|
|
|
#
|
|
|
|
# services.nextcloud-whiteboard-server = {
|
|
|
|
# enable = true;
|
|
|
|
# settings.NEXTCLOUD_URL = "https://nextcloud.skynet.ie";
|
|
|
|
# secrets = ["/etc/nextcloud-whiteboard-secret"];
|
|
|
|
# };
|
|
|
|
|
2023-10-27 00:54:41 +00:00
|
|
|
nixpkgs.config.allowUnfree = true;
|
2024-11-01 23:16:45 +00:00
|
|
|
# impacted by https://github.com/NixOS /nixpkgs/issues/352443
|
2023-10-27 00:54:41 +00:00
|
|
|
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";
|
|
|
|
};
|
2024-11-01 23:16:45 +00:00
|
|
|
# "whiteboard.${domain}" = {
|
|
|
|
# forceSSL = true;
|
|
|
|
# useACMEHost = "skynet";
|
|
|
|
# locations."/" = {
|
|
|
|
# proxyPass = "http://localhost:3002";
|
|
|
|
# proxyWebsockets = true;
|
|
|
|
# };
|
|
|
|
# };
|
2023-10-22 13:27:42 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|