at master 2.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 unzip, 6 writeText, 7 dos2unix, 8 dataPath ? "/var/lib/rainloop", 9}: 10let 11 common = 12 { edition, sha256 }: 13 stdenv.mkDerivation (rec { 14 pname = "rainloop${lib.optionalString (edition != "") "-${edition}"}"; 15 version = "1.16.0"; 16 17 nativeBuildInputs = [ 18 unzip 19 dos2unix 20 ]; 21 22 unpackPhase = '' 23 mkdir rainloop 24 unzip -q -d rainloop $src 25 ''; 26 27 src = fetchurl { 28 url = "https://github.com/RainLoop/rainloop-webmail/releases/download/v${version}/rainloop-${edition}${ 29 lib.optionalString (edition != "") "-" 30 }${version}.zip"; 31 sha256 = sha256; 32 }; 33 34 prePatch = '' 35 dos2unix ./rainloop/rainloop/v/1.16.0/app/libraries/MailSo/Base/HtmlUtils.php 36 ''; 37 38 patches = [ 39 ./fix-cve-2022-29360.patch 40 ]; 41 42 postPatch = '' 43 unix2dos ./rainloop/rainloop/v/1.16.0/app/libraries/MailSo/Base/HtmlUtils.php 44 ''; 45 46 includeScript = writeText "include.php" '' 47 <?php 48 49 /** 50 * @return string 51 */ 52 function __get_custom_data_full_path() 53 { 54 $v = getenv('RAINLOOP_DATA_DIR', TRUE); 55 return $v === FALSE ? '${dataPath}' : $v; 56 } 57 ''; 58 59 installPhase = '' 60 mkdir $out 61 cp -r rainloop/* $out 62 rm -rf $out/data 63 cp ${includeScript} $out/include.php 64 mkdir $out/data 65 chmod 700 $out/data 66 ''; 67 68 meta = with lib; { 69 description = "Simple, modern & fast web-based email client"; 70 homepage = "https://www.rainloop.net"; 71 downloadPage = "https://github.com/RainLoop/rainloop-webmail/releases"; 72 license = with licenses; if edition == "" then unfree else agpl3Only; 73 platforms = platforms.all; 74 maintainers = with maintainers; [ das_j ]; 75 }; 76 }); 77in 78{ 79 rainloop-community = common { 80 edition = "community"; 81 sha256 = "sha256-25ScQ2OwSKAuqg8GomqDhpebhzQZjCk57h6MxUNiymc="; 82 }; 83 rainloop-standard = common { 84 edition = ""; 85 sha256 = "sha256-aYCwqFqhJEeakn4R0MUDGcSp+M47JbbCrbYaML8aeSs="; 86 }; 87}