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