]>
Commit | Line | Data |
---|---|---|
fffbbb56 IB |
1 | { varDir ? "/var/lib/roundcubemail" |
2 | , roundcube_config ? "/etc/roundcube/config.php" | |
9271611c | 3 | , stdenv, fetchurl, jre, unzip }: |
fffbbb56 IB |
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 | }); | |
9271611c IB |
36 | shrinker = fetchurl { |
37 | url = "http://dl.google.com/closure-compiler/compiler-latest.zip"; | |
38 | sha256 = "0naf3kflhlkm17ls1x7mgddd3b01f8yzbbbdjqwy5m12jmkzl2d5"; | |
39 | }; | |
fffbbb56 | 40 | package = stdenv.mkDerivation rec { |
9271611c | 41 | version = "1.4.4"; |
fffbbb56 IB |
42 | name = "roundcubemail-${version}"; |
43 | src= fetchurl { | |
44 | url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz"; | |
9271611c | 45 | sha256 = "1my726p0wmsn21nbdsjx02h6hnbh8nidzipzdy0gk0qgda1j729b"; |
fffbbb56 | 46 | }; |
9271611c IB |
47 | patches = [ ./add_all.patch ]; # This patch includes js modification which requires to re-run the jsshrink below |
48 | buildInputs = [ unzip jre ]; | |
fffbbb56 | 49 | buildPhase = '' |
9271611c IB |
50 | mkdir -p /tmp |
51 | unzip -p "${shrinker}" "*.jar" > "/tmp/compiler.jar" | |
52 | ./bin/jsshrink.sh | |
fffbbb56 IB |
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 |