Add collabora-online service

This commit is contained in:
pazpi 2026-02-04 13:39:18 +01:00
parent 8e5900d375
commit 5b083bff91
2 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,75 @@
{
lib,
config,
pkgs,
...
}:
let
cfg = config.my.services.collabora-online;
in
{
options.my.services.collabora-online = {
enable = lib.mkEnableOption "Enable Collabora Online module";
proxy = {
enable = lib.mkEnableOption "Set the proxy entry for this service";
domain = lib.mkOption {
default = "example.com";
type = lib.types.str;
description = ''
The domain where Caddy is reachable
'';
};
subdomain = lib.mkOption {
default = "collabora";
type = lib.types.str;
description = ''
The subdomain where Collabora Online is reachable
'';
};
host = lib.mkOption {
default = "localhost";
type = lib.types.str;
description = ''
Host name where Collabora Online is running
'';
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
services.collabora-online = {
enable = true;
# settings = {
# host = [
# ''127\.0\.0\.1''
# ];
# storage.wopi."@allow" = true;
# };
};
networking.firewall.allowedTCPPorts = [
config.services.collabora-online.port
];
})
(lib.mkIf cfg.proxy.enable {
services.caddy = with cfg.proxy; {
virtualHosts."${subdomain}.${domain}".extraConfig = ''
import cloudflare_${domain}
reverse_proxy http://${host}:${toString config.services.collabora-online.port} {
# Required to circumvent bug of Onlyoffice loading mixed non-https content
header_up X-Forwarded-Proto https
}
'';
};
})
];
}