Roundcube WiP
This commit is contained in:
parent
cb4b7e370d
commit
0eefc16784
4 changed files with 101 additions and 141 deletions
60
clients/quadraticserver/mail/roundcube/default.nix
Normal file
60
clients/quadraticserver/mail/roundcube/default.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services = {
|
||||
phpfpm.pools.roundcube.settings = {
|
||||
"listen.owner" = "caddy";
|
||||
"listen.group" = "caddy";
|
||||
};
|
||||
roundcube = {
|
||||
enable = true;
|
||||
configureNginx = false;
|
||||
|
||||
package = pkgs.roundcube.overrideAttrs (oldAttrs: {
|
||||
version = "1.7-beta";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/roundcube/roundcubemail/releases/download/1.7-beta/roundcubemail-1.7-beta-complete.tar.gz";
|
||||
sha256 = "sha256-gYY+tyR1aPAo43oH3Prgwd0A7XmiFASZ7KWxXuf4vpk=";
|
||||
};
|
||||
|
||||
patches = [./update.patch];
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r * $out/
|
||||
ln -sf /etc/roundcube/config.inc.php $out/config/config.inc.php
|
||||
rm -rf $out/installer
|
||||
'';
|
||||
});
|
||||
|
||||
extraConfig = ''
|
||||
// General
|
||||
$config["skin_logo"] = "https://federated.nexus/images/icon.svg";
|
||||
$config["use_https"] = true;
|
||||
|
||||
// OAuth
|
||||
$config["oauth_provider"] = "generic";
|
||||
$config["oauth_provider_name"] = "Federated Nexus";
|
||||
$config["oauth_login_redirect"] = true;
|
||||
|
||||
$config["oauth_config_uri"] = "https://auth.federated.nexus/.well-known/openid-configuration";
|
||||
|
||||
$config["oauth_client_id"] = "roundcube";
|
||||
$config["oauth_client_secret"] = "secret";
|
||||
|
||||
$config["oauth_scope"] = "";
|
||||
$config["oauth_scope"] = "";
|
||||
'';
|
||||
};
|
||||
|
||||
caddy.virtualHosts."mail.federated.nexus".extraConfig = ''
|
||||
root * ${config.services.roundcube.package}/public_html
|
||||
|
||||
php_fastcgi unix/${config.services.phpfpm.pools.roundcube.socket}
|
||||
file_server
|
||||
'';
|
||||
};
|
||||
}
|
22
clients/quadraticserver/mail/roundcube/update.patch
Normal file
22
clients/quadraticserver/mail/roundcube/update.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
From c0a516b09316a8bb73c872d9da2f584e5ed5b112 Mon Sep 17 00:00:00 2001
|
||||
From: Henry Hiles <henry@henryhiles.com>
|
||||
Date: Mon, 21 Jul 2025 21:27:10 -0400
|
||||
Subject: [PATCH] Fix update script for nix
|
||||
|
||||
---
|
||||
bin/update.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bin/update.sh b/bin/update.sh
|
||||
index 5058f33f16..41361d9481 100755
|
||||
--- a/bin/update.sh
|
||||
+++ b/bin/update.sh
|
||||
@@ -19,7 +19,7 @@
|
||||
+-----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
-define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/');
|
||||
+define('INSTALL_PATH', dirname(dirname($argv[0])).'/');
|
||||
|
||||
require_once INSTALL_PATH . 'program/include/clisetup.php';
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
sogo = prev.sogo.overrideAttrs (old: {
|
||||
buildInputs = old.buildInputs ++ [prev.postgresql.lib];
|
||||
NIX_LDFLAGS = (old.NIX_LDFLAGS or "") + " -lpq";
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
services = let
|
||||
domain = "mail.federated.nexus";
|
||||
in {
|
||||
memcached = {
|
||||
enable = true;
|
||||
user = "sogo";
|
||||
enableUnixSocket = true;
|
||||
extraOptions = [
|
||||
"-a"
|
||||
"0600"
|
||||
];
|
||||
};
|
||||
|
||||
postgresql = {
|
||||
enable = true;
|
||||
enableTCPIP = true;
|
||||
|
||||
ensureDatabases = ["sogo"];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "sogo";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
sogo = {
|
||||
enable = true;
|
||||
timezone = config.time.timeZone;
|
||||
extraConfig = let
|
||||
db = "postgresql://sogo@127.0.0.1/sogo";
|
||||
in ''
|
||||
SOGoMailDomain = "federated.nexus";
|
||||
SOGoMemcachedHost = "/run/memcached/memcached.sock";
|
||||
|
||||
SOGoAuthenticationType = "openid";
|
||||
SOGoOpenIdConfigUrl = "https://auth.federated.nexus/.well-known/openid-configuration";
|
||||
SOGoOpenIdClient = "Federated Nexus Auth";
|
||||
SOGoOpenIdClientSecret = "";
|
||||
SOGoOpenIdScope = "";
|
||||
SOGoOpenIdTokenCheckInterval = 600;
|
||||
|
||||
SOGoSMTPServer = "smtp://localhost";
|
||||
SOGoSMTPAuthenticationType = "xoauth2";
|
||||
|
||||
SOGoIMAPServer = "imap://localhost";
|
||||
NGImap4AuthMechanism = "xoauth2";
|
||||
|
||||
SOGoPageTitle = "Federated Nexus Mail";
|
||||
SOGoZipPath = "${lib.getExe pkgs.zip}";
|
||||
|
||||
OCSSessionsFolderURL = "${db}/sogo_sessions_folder";
|
||||
OCSFolderInfoURL = "${db}/sogo_folder_info";
|
||||
OCSOpenIdURL = "${db}/sogo_openid";
|
||||
MySQL4Encoding = "utf8mb4";
|
||||
'';
|
||||
};
|
||||
|
||||
caddy.virtualHosts."${domain}".extraConfig = ''
|
||||
# Redirect root to /SOGo
|
||||
@root path /
|
||||
redir @root https://{host}/SOGo
|
||||
|
||||
# Redirect /principals/ to /SOGo/dav
|
||||
@principals path /principals/*
|
||||
redir @principals https://{host}/SOGo/dav
|
||||
|
||||
# Static assets for SOGo
|
||||
handle_path /SOGo.woa/WebServerResources/* {
|
||||
root * ${pkgs.sogo}/lib/GNUstep/SOGo/WebServerResources/
|
||||
file_server
|
||||
}
|
||||
|
||||
handle_path /SOGo/WebServerResources/* {
|
||||
root * ${pkgs.sogo}/lib/GNUstep/SOGo/
|
||||
file_server
|
||||
}
|
||||
|
||||
# Regex match: ControlPanel products
|
||||
@resources1 path_regexp resources1 ^/SOGo/so/ControlPanel/Products/([^/]*)/Resources/(.*)$
|
||||
handle @resources1 {
|
||||
root * ${pkgs.sogo}/lib/GNUstep/SOGo/{http.regexp.resources1.1}.SOGo/Resources/
|
||||
rewrite * /{http.regexp.resources1.2}
|
||||
file_server
|
||||
}
|
||||
|
||||
# Regex match: ControlPanel UI resources
|
||||
@resources2 path_regexp resources2 ^/SOGo/so/ControlPanel/Products/([^/]*)UI/Resources/(.*\.(jpg|png|gif|css|js))$
|
||||
handle @resources2 {
|
||||
root * ${pkgs.sogo}/lib/GNUstep/SOGo/{http.regexp.resources2.1}UI.SOGo/Resources/
|
||||
rewrite * /{http.regexp.resources2.2}
|
||||
file_server
|
||||
}
|
||||
|
||||
# SOGo app proxy
|
||||
handle_path /SOGo* {
|
||||
reverse_proxy 127.0.0.1:20000 {
|
||||
header_up x-webobjects-server-protocol HTTP/1.0
|
||||
header_up x-webobjects-remote-host 127.0.0.1
|
||||
header_up x-webobjects-server-port {server_port}
|
||||
header_up x-webobjects-server-name {host}
|
||||
header_up x-webobjects-server-url {scheme}://{host}
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue