]>
Commit | Line | Data |
---|---|---|
1 | { varDir ? "/var/lib/roundcubemail" | |
2 | , roundcube_config ? "/etc/roundcube/config.php" | |
3 | , stdenv, fetchurl, jre, unzip }: | |
4 | let | |
5 | defaultInstall = '' | |
6 | mkdir -p $out | |
7 | cp -R . $out/ | |
8 | cd $out | |
9 | if [ -d skins -a -d skins/larry -a ! -d skins/elastic ]; then | |
10 | ln -s larry skins/elastic | |
11 | fi | |
12 | ''; | |
13 | buildPlugin = { appName, version, url, sha256, installPhase ? defaultInstall }: | |
14 | stdenv.mkDerivation rec { | |
15 | name = "roundcube-${appName}-${version}"; | |
16 | inherit version; | |
17 | phases = "unpackPhase installPhase"; | |
18 | inherit installPhase; | |
19 | src = fetchurl { inherit url sha256; }; | |
20 | passthru.pluginName = appName; | |
21 | }; | |
22 | withPlugins = plugins: skins: package.overrideAttrs(old: { | |
23 | name = "${old.name}${if builtins.length skins > 0 then "-with-skins" else ""}${if builtins.length plugins > 0 then "-with-plugins" else ""}"; | |
24 | installPhase = old.installPhase + | |
25 | builtins.concatStringsSep "\n" ( | |
26 | map (value: "ln -s ${value} $out/plugins/${value.pluginName}") plugins | |
27 | ) + | |
28 | builtins.concatStringsSep "\n" ( | |
29 | map (value: "ln -s ${value} $out/skins/${value.skinName}") skins | |
30 | ); | |
31 | passthru = old.passthru // { | |
32 | inherit plugins skins; | |
33 | withPlugins = morePlugins: moreSkins: old.withPlugins (morePlugins ++ plugins) (morePlugins ++ skins); | |
34 | }; | |
35 | }); | |
36 | shrinker = fetchurl { | |
37 | url = "http://dl.google.com/closure-compiler/compiler-latest.zip"; | |
38 | sha256 = "0naf3kflhlkm17ls1x7mgddd3b01f8yzbbbdjqwy5m12jmkzl2d5"; | |
39 | }; | |
40 | package = stdenv.mkDerivation rec { | |
41 | version = "1.4.4"; | |
42 | name = "roundcubemail-${version}"; | |
43 | src= fetchurl { | |
44 | url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz"; | |
45 | sha256 = "1my726p0wmsn21nbdsjx02h6hnbh8nidzipzdy0gk0qgda1j729b"; | |
46 | }; | |
47 | patches = [ ./add_all.patch ]; # This patch includes js modification which requires to re-run the jsshrink below | |
48 | buildInputs = [ unzip jre ]; | |
49 | buildPhase = '' | |
50 | mkdir -p /tmp | |
51 | unzip -p "${shrinker}" "*.jar" > "/tmp/compiler.jar" | |
52 | ./bin/jsshrink.sh | |
53 | sed -i \ | |
54 | -e "s|RCUBE_INSTALL_PATH . 'temp.*|'${varDir}/cache';|" \ | |
55 | config/defaults.inc.php | |
56 | sed -i \ | |
57 | -e "s|RCUBE_INSTALL_PATH . 'logs.*|'${varDir}/logs';|" \ | |
58 | config/defaults.inc.php | |
59 | ''; | |
60 | installPhase = '' | |
61 | cp -a . $out | |
62 | ln -s ${roundcube_config} $out/config/config.inc.php | |
63 | ''; | |
64 | passthru = { | |
65 | plugins = []; | |
66 | skins = []; | |
67 | inherit withPlugins buildPlugin; | |
68 | }; | |
69 | }; | |
70 | in package |