git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #58804 from Ma27/roundcube-fixes

roundcube: minor fixes

commitf370553f8fb7f789603cbd76e9f0268f70413e6b authorRobin Gloster <mail@glob.in> dateTue 9 Apr 2019, 18:30 (8 years ago) parent2e35154324e6db
3 files changed+66−28
nixos/modules/services/mail/roundcube.nix+24−20 pkgs/servers/roundcube/0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch+27 pkgs/servers/roundcube/default.nix+15−8
nixos/modules/services/mail/roundcube.nix+24−20
@@ -141,27 +141,31 @@ in
141141
142142 systemd.services.roundcube-setup = let
143143 pgSuperUser = config.services.postgresql.superUser;
144− in {
145− requires = [ "postgresql.service" ];
146− after = [ "postgresql.service" ];
147− wantedBy = [ "multi-user.target" ];
148− path = [ config.services.postgresql.package ];
149− script = ''
150− mkdir -p /var/lib/roundcube
151− if [ ! -f /var/lib/roundcube/db-created ]; then
152− if [ "${cfg.database.host}" = "localhost" ]; then
153− ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create role ${cfg.database.username} with login password '${cfg.database.password}'";
154− ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create database ${cfg.database.dbname} with owner ${cfg.database.username}";
144+ in mkMerge [
145+ (mkIf (cfg.database.host == "localhost") {
146+ requires = [ "postgresql.service" ];
147+ after = [ "postgresql.service" ];
148+ path = [ config.services.postgresql.package ];
149+ })
150+ {
151+ wantedBy = [ "multi-user.target" ];
152+ script = ''
153+ mkdir -p /var/lib/roundcube
154+ if [ ! -f /var/lib/roundcube/db-created ]; then
155+ if [ "${cfg.database.host}" = "localhost" ]; then
156+ ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create role ${cfg.database.username} with login password '${cfg.database.password}'";
157+ ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create database ${cfg.database.dbname} with owner ${cfg.database.username}";
158+ fi
159+ PGPASSWORD=${cfg.database.password} ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
160+ -f ${cfg.package}/SQL/postgres.initial.sql \
161+ -h ${cfg.database.host} ${cfg.database.dbname}
162+ touch /var/lib/roundcube/db-created
155163 fi
156− PGPASSWORD=${cfg.database.password} ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
157− -f ${cfg.package}/SQL/postgres.initial.sql \
158− -h ${cfg.database.host} ${cfg.database.dbname}
159− touch /var/lib/roundcube/db-created
160− fi
161164
162− ${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
163− '';
164− serviceConfig.Type = "oneshot";
165− };
165+ ${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
166+ '';
167+ serviceConfig.Type = "oneshot";
168+ }
169+ ];
166170 };
167171}
pkgs/servers/roundcube/0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patchnew file+27
@@ -0,0 +1,27 @@
1+From c1832eabb99cec47f1714f696275285e1e28da34 Mon Sep 17 00:00:00 2001
2+From: Maximilian Bosch <maximilian@mbosch.me>
3+Date: Tue, 2 Apr 2019 16:20:50 +0200
4+Subject: [PATCH] Don't resolve symlinks when trying to find INSTALL_PATH
5+
6+Nix specific patch. This behavior breaks roundcube setups where plugins
7+are in a store path with symlinks to the actual source.
8+---
9+ bin/update.sh | 2 +-
10+ 1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+diff --git a/bin/update.sh b/bin/update.sh
13+index 08e3bb5..b2ad498 100755
14+--- a/bin/update.sh
15++++ b/bin/update.sh
16+@@ -19,7 +19,7 @@
17+ +-----------------------------------------------------------------------+
18+ */
19+
20+-define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
21++define('INSTALL_PATH', __DIR__ . '/../' );
22+
23+ require_once INSTALL_PATH . 'program/include/clisetup.php';
24+
25+--
26+2.19.2
27+
pkgs/servers/roundcube/default.nix+15−8
@@ -1,14 +1,21 @@
1−{ lib, stdenv, fetchzip, buildEnv, roundcube, roundcubePlugins }:
2−let
1+{ lib, fetchurl, stdenv, buildEnv, roundcube, roundcubePlugins }:
2+
3+stdenv.mkDerivation rec {
4+ pname = "roundcube";
35 version = "1.3.8";
4−in
5−fetchzip rec {
6− name= "roundcube-${version}";
76
8− url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/roundcubemail-${version}-complete.tar.gz";
9− sha256 = "1lhwr13bglm8rqgamnb480b07wpqhw9bskjj2xxb0x8kdjly29ks";
7+ src = fetchurl {
8+ url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/roundcubemail-${version}-complete.tar.gz";
9+ sha256 = "018djad7ygfl9c9f2l2j42qkg31ml3hs2f01f0dk361zckwk77n4";
10+ };
11+
12+ patches = [ ./0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch ];
13+
14+ dontBuild = true;
1015
11− extraPostFetch = ''
16+ installPhase = ''
17+ mkdir $out
18+ cp -r * $out/
1219 ln -sf /etc/roundcube/config.inc.php $out/config/config.inc.php
1320 rm -rf $out/installer
1421 '';