diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-12-13 21:25:24 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-24 01:40:13 +0200 |
commit | 24fd1fe6c62b7a9fc347794fde043285da272f5c (patch) | |
tree | 65557bf1d241ca389b619dbd24d18d51932ee030 /pkgs/webapps/roundcubemail/default.nix | |
download | NUR-24fd1fe6c62b7a9fc347794fde043285da272f5c.tar.gz NUR-24fd1fe6c62b7a9fc347794fde043285da272f5c.tar.zst NUR-24fd1fe6c62b7a9fc347794fde043285da272f5c.zip |
Initial commit published for NUR
Diffstat (limited to 'pkgs/webapps/roundcubemail/default.nix')
-rw-r--r-- | pkgs/webapps/roundcubemail/default.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/webapps/roundcubemail/default.nix b/pkgs/webapps/roundcubemail/default.nix new file mode 100644 index 00000000..ba85f372 --- /dev/null +++ b/pkgs/webapps/roundcubemail/default.nix | |||
@@ -0,0 +1,61 @@ | |||
1 | { varDir ? "/var/lib/roundcubemail" | ||
2 | , roundcube_config ? "/etc/roundcube/config.php" | ||
3 | , stdenv, fetchurl }: | ||
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 | package = stdenv.mkDerivation rec { | ||
37 | version = "1.4-rc1"; | ||
38 | name = "roundcubemail-${version}"; | ||
39 | src= fetchurl { | ||
40 | url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz"; | ||
41 | sha256 = "0p18wffwi2prh6vxhx1bc69qd1vwybggm8gvg3shahfdknxci9i4"; | ||
42 | }; | ||
43 | buildPhase = '' | ||
44 | sed -i \ | ||
45 | -e "s|RCUBE_INSTALL_PATH . 'temp.*|'${varDir}/cache';|" \ | ||
46 | config/defaults.inc.php | ||
47 | sed -i \ | ||
48 | -e "s|RCUBE_INSTALL_PATH . 'logs.*|'${varDir}/logs';|" \ | ||
49 | config/defaults.inc.php | ||
50 | ''; | ||
51 | installPhase = '' | ||
52 | cp -a . $out | ||
53 | ln -s ${roundcube_config} $out/config/config.inc.php | ||
54 | ''; | ||
55 | passthru = { | ||
56 | plugins = []; | ||
57 | skins = []; | ||
58 | inherit withPlugins buildPlugin; | ||
59 | }; | ||
60 | }; | ||
61 | in package | ||