2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, unzip, pkgs, dataPath ? "/var/lib/rainloop" }: let
|
2020-04-24 23:36:52 +00:00
|
|
|
common = { edition, sha256 }:
|
|
|
|
stdenv.mkDerivation (rec {
|
2021-01-15 22:18:51 +00:00
|
|
|
pname = "rainloop${lib.optionalString (edition != "") "-${edition}"}";
|
2020-04-24 23:36:52 +00:00
|
|
|
version = "1.14.0";
|
|
|
|
|
|
|
|
buildInputs = [ unzip ];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
mkdir rainloop
|
|
|
|
unzip -q -d rainloop $src
|
|
|
|
'';
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-15 22:18:51 +00:00
|
|
|
url = "https://github.com/RainLoop/rainloop-webmail/releases/download/v${version}/rainloop-${edition}${lib.optionalString (edition != "") "-"}${version}.zip";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = sha256;
|
|
|
|
};
|
|
|
|
|
|
|
|
includeScript = pkgs.writeText "include.php" ''
|
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function __get_custom_data_full_path()
|
|
|
|
{
|
2020-11-30 08:33:03 +00:00
|
|
|
$v = getenv('RAINLOOP_DATA_DIR', TRUE);
|
|
|
|
return $v === FALSE ? '${dataPath}' : $v;
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp -r rainloop/* $out
|
|
|
|
rm -rf $out/data
|
|
|
|
cp ${includeScript} $out/include.php
|
2020-11-30 08:33:03 +00:00
|
|
|
mkdir $out/data
|
|
|
|
chmod 700 $out/data
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Simple, modern & fast web-based email client";
|
|
|
|
homepage = "https://www.rainloop.net";
|
|
|
|
downloadPage = "https://github.com/RainLoop/rainloop-webmail/releases";
|
|
|
|
license = with licenses; if edition == "" then unfree else agpl3;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ das_j ];
|
|
|
|
};
|
|
|
|
});
|
2020-11-30 08:33:03 +00:00
|
|
|
in {
|
|
|
|
rainloop-community = common {
|
|
|
|
edition = "community";
|
|
|
|
sha256 = "0a8qafm4khwj8cnaiaxvjb9073w6fr63vk1b89nks4hmfv10jn6y";
|
|
|
|
};
|
|
|
|
rainloop-standard = common {
|
|
|
|
edition = "";
|
|
|
|
sha256 = "0961g4mci080f7y98zx9r4qw620l4z3na1ivvlyhhr1v4dywqvch";
|
|
|
|
};
|
|
|
|
}
|