2022-07-23 03:45:24 +00:00
|
|
|
{ lib, stdenv, fetchurl, unzip, writeText, dos2unix, dataPath ? "/var/lib/rainloop" }: let
|
2018-06-28 19:54:44 +00:00
|
|
|
common = { edition, sha256 }:
|
|
|
|
stdenv.mkDerivation (rec {
|
2021-01-15 07:07:56 +00:00
|
|
|
pname = "rainloop${lib.optionalString (edition != "") "-${edition}"}";
|
2021-06-11 07:20:23 +00:00
|
|
|
version = "1.16.0";
|
2018-06-28 19:54:44 +00:00
|
|
|
|
2022-07-23 03:45:24 +00:00
|
|
|
nativeBuildInputs = [ unzip dos2unix ];
|
2018-06-28 19:54:44 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
mkdir rainloop
|
|
|
|
unzip -q -d rainloop $src
|
|
|
|
'';
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-15 07:07:56 +00:00
|
|
|
url = "https://github.com/RainLoop/rainloop-webmail/releases/download/v${version}/rainloop-${edition}${lib.optionalString (edition != "") "-"}${version}.zip";
|
2018-06-28 19:54:44 +00:00
|
|
|
sha256 = sha256;
|
|
|
|
};
|
|
|
|
|
2022-07-23 03:45:24 +00:00
|
|
|
prePatch = ''
|
|
|
|
dos2unix ./rainloop/rainloop/v/1.16.0/app/libraries/MailSo/Base/HtmlUtils.php
|
|
|
|
'';
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./fix-cve-2022-29360.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
unix2dos ./rainloop/rainloop/v/1.16.0/app/libraries/MailSo/Base/HtmlUtils.php
|
|
|
|
'';
|
|
|
|
|
|
|
|
includeScript = writeText "include.php" ''
|
2020-02-23 20:18:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function __get_custom_data_full_path()
|
|
|
|
{
|
2020-09-06 03:04:19 +00:00
|
|
|
$v = getenv('RAINLOOP_DATA_DIR', TRUE);
|
|
|
|
return $v === FALSE ? '${dataPath}' : $v;
|
2020-02-23 20:18:49 +00:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2018-06-28 19:54:44 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp -r rainloop/* $out
|
|
|
|
rm -rf $out/data
|
2020-02-23 20:18:49 +00:00
|
|
|
cp ${includeScript} $out/include.php
|
2020-09-06 03:04:19 +00:00
|
|
|
mkdir $out/data
|
|
|
|
chmod 700 $out/data
|
2018-06-28 19:54:44 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-06-28 19:54:44 +00:00
|
|
|
description = "Simple, modern & fast web-based email client";
|
|
|
|
homepage = "https://www.rainloop.net";
|
2019-11-23 14:36:28 +00:00
|
|
|
downloadPage = "https://github.com/RainLoop/rainloop-webmail/releases";
|
2024-03-19 12:26:06 +00:00
|
|
|
license = with licenses; if edition == "" then unfree else agpl3Only;
|
2018-06-28 19:54:44 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ das_j ];
|
|
|
|
};
|
|
|
|
});
|
2020-09-06 03:04:19 +00:00
|
|
|
in {
|
|
|
|
rainloop-community = common {
|
|
|
|
edition = "community";
|
2021-06-11 07:20:23 +00:00
|
|
|
sha256 = "sha256-25ScQ2OwSKAuqg8GomqDhpebhzQZjCk57h6MxUNiymc=";
|
2020-09-06 03:04:19 +00:00
|
|
|
};
|
|
|
|
rainloop-standard = common {
|
|
|
|
edition = "";
|
2021-06-11 07:20:23 +00:00
|
|
|
sha256 = "sha256-aYCwqFqhJEeakn4R0MUDGcSp+M47JbbCrbYaML8aeSs=";
|
2020-09-06 03:04:19 +00:00
|
|
|
};
|
|
|
|
}
|