From f449f1bac5c443ef84330457914d88454317243d Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 14 May 2026 18:23:48 +0200 Subject: [PATCH 1/3] roundcube: 1.6.15 -> 1.7.0 ChangeLog: https://github.com/roundcube/roundcubemail/releases/tag/1.7.0 --- nixos/modules/services/mail/roundcube.nix | 15 +------ ...mlinks-when-trying-to-find-INSTALL_P.patch | 42 ++++++++++++++++--- pkgs/servers/roundcube/default.nix | 14 ++++--- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/nixos/modules/services/mail/roundcube.nix b/nixos/modules/services/mail/roundcube.nix index c58832daac19..16e3c7d81e7c 100644 --- a/nixos/modules/services/mail/roundcube.nix +++ b/nixos/modules/services/mail/roundcube.nix @@ -184,7 +184,7 @@ in ${cfg.hostName} = { forceSSL = lib.mkDefault true; enableACME = lib.mkDefault true; - root = cfg.package; + root = cfg.package + "/public_html"; locations."/" = { index = "index.php"; priority = 1100; @@ -193,19 +193,6 @@ in client_max_body_size ${toString cfg.maxAttachmentSize}; ''; }; - locations."~ ^/(SQL|bin|config|logs|temp|vendor)/" = { - priority = 3110; - extraConfig = '' - return 404; - ''; - }; - locations."~ ^/(CHANGELOG.md|INSTALL|LICENSE|README.md|SECURITY.md|UPGRADING|composer.json|composer.lock)" = - { - priority = 3120; - extraConfig = '' - return 404; - ''; - }; locations."~* \\.php(/|$)" = { priority = 3130; extraConfig = '' diff --git a/pkgs/servers/roundcube/0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch b/pkgs/servers/roundcube/0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch index 27ebd59a48d9..4d8168ed742a 100644 --- a/pkgs/servers/roundcube/0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch +++ b/pkgs/servers/roundcube/0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch @@ -1,27 +1,57 @@ -From c1832eabb99cec47f1714f696275285e1e28da34 Mon Sep 17 00:00:00 2001 +From c6b017ce9e85e7a27f65429ba41d3642bd6dc393 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 2 Apr 2019 16:20:50 +0200 Subject: [PATCH] Don't resolve symlinks when trying to find INSTALL_PATH Nix specific patch. This behavior breaks roundcube setups where plugins are in a store path with symlinks to the actual source. + +Also, __DIR__ resolves the symlink from `buildEnv`, so we do +$_SERVER['SCRIPT_FILENAME'] instead. --- - bin/update.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + bin/update.sh | 2 +- + public_html/index.php | 1 + + public_html/static.php | 2 +- + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/update.sh b/bin/update.sh -index 08e3bb5..b2ad498 100755 +index 4d8e829cc..3810aa2b9 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ --define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' ); +-define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/'); +define('INSTALL_PATH', dirname(dirname($argv[0])).'/'); require_once INSTALL_PATH . 'program/include/clisetup.php'; +diff --git a/public_html/index.php b/public_html/index.php +index f8a0c4973..5fd1c57ec 100644 +--- a/public_html/index.php ++++ b/public_html/index.php +@@ -36,6 +36,7 @@ + +-------------------------------------------------------------------------+ + */ + ++define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/../'); + // include environment + require_once __DIR__ . '/../program/include/iniset.php'; + +diff --git a/public_html/static.php b/public_html/static.php +index f954ef365..a2cc3c24c 100644 +--- a/public_html/static.php ++++ b/public_html/static.php +@@ -54,7 +54,7 @@ const ALLOWED_PATHS = [ + 'skins/', + ]; + +-define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/'); ++define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/../'); + + $path = validateStaticFile($_SERVER['PATH_INFO']); + -- -2.19.2 +2.51.2 diff --git a/pkgs/servers/roundcube/default.nix b/pkgs/servers/roundcube/default.nix index f3ba282ef41f..6ed84bd702e4 100644 --- a/pkgs/servers/roundcube/default.nix +++ b/pkgs/servers/roundcube/default.nix @@ -6,15 +6,16 @@ roundcube, roundcubePlugins, nixosTests, + runCommand, }: stdenv.mkDerivation rec { pname = "roundcube"; - version = "1.6.15"; + version = "1.7.0"; src = fetchurl { url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/roundcubemail-${version}-complete.tar.gz"; - sha256 = "sha256-SMnyEsd0YBMkkfZwq69EC3ZcgnYmg0mmkJE3ZNJq++8="; + sha256 = "sha256-o0w2baK3okrUpjgrS7mmd8tYHuCL/GME0KmnIQmOepg="; }; patches = [ ./0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch ]; @@ -29,15 +30,18 @@ stdenv.mkDerivation rec { cp -r * $out/ ln -sf /etc/roundcube/config.inc.php $out/config/config.inc.php rm -rf $out/installer - # shut up updater - rm $out/composer.json-dist ''; passthru.withPlugins = f: buildEnv { name = "${roundcube.name}-with-plugins"; - paths = (f roundcubePlugins) ++ [ roundcube ]; + paths = (f roundcubePlugins) ++ [ + roundcube + (runCommand "dummy" { } '' + mkdir -p $out/public_html/ + '') + ]; }; passthru.tests = { inherit (nixosTests) roundcube; }; From 3f732679b813e1a56dc907c50fa85d698e4a568e Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 14 May 2026 18:25:21 +0200 Subject: [PATCH 2/3] nixos/roundcube: use php 8.4 --- nixos/modules/services/mail/roundcube.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/mail/roundcube.nix b/nixos/modules/services/mail/roundcube.nix index 16e3c7d81e7c..d5990950a2b3 100644 --- a/nixos/modules/services/mail/roundcube.nix +++ b/nixos/modules/services/mail/roundcube.nix @@ -9,7 +9,7 @@ let fpm = config.services.phpfpm.pools.roundcube; localDB = cfg.database.host == "localhost"; user = cfg.database.username; - phpWithPspell = pkgs.php83.withExtensions ({ enabled, all }: [ all.pspell ] ++ enabled); + phpWithPspell = pkgs.php84.withExtensions ({ enabled, all }: [ all.pspell ] ++ enabled); env = { ASPELL_CONF = "dict-dir ${pkgs.aspellWithDicts (_: cfg.dicts)}/lib/aspell"; From e9d0fe01f739a28769ed5605d450377d8a3d81a9 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 14 May 2026 18:25:29 +0200 Subject: [PATCH 3/3] nixos/roundcube: use python assertion for inspecting response That way we always see what's being returned. --- nixos/tests/roundcube.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/roundcube.nix b/nixos/tests/roundcube.nix index fd9c72915943..48e7fa59b4ef 100644 --- a/nixos/tests/roundcube.nix +++ b/nixos/tests/roundcube.nix @@ -33,6 +33,6 @@ roundcube.wait_for_unit("postgresql.target") roundcube.wait_for_unit("phpfpm-roundcube.service") roundcube.wait_for_unit("nginx.service") - roundcube.succeed("curl -sSfL http://roundcube/ | grep 'Keep me logged in'") + t.assertIn("Keep me logged in", roundcube.succeed("curl -sSfL http://roundcube/")) ''; }