at 22.05-pre 59 lines 1.8 kB view raw
1{ lib, stdenv, fetchurl, unzip, pkgs, 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 ]; 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 includeScript = pkgs.writeText "include.php" '' 20 <?php 21 22 /** 23 * @return string 24 */ 25 function __get_custom_data_full_path() 26 { 27 $v = getenv('RAINLOOP_DATA_DIR', TRUE); 28 return $v === FALSE ? '${dataPath}' : $v; 29 } 30 ''; 31 32 installPhase = '' 33 mkdir $out 34 cp -r rainloop/* $out 35 rm -rf $out/data 36 cp ${includeScript} $out/include.php 37 mkdir $out/data 38 chmod 700 $out/data 39 ''; 40 41 meta = with lib; { 42 description = "Simple, modern & fast web-based email client"; 43 homepage = "https://www.rainloop.net"; 44 downloadPage = "https://github.com/RainLoop/rainloop-webmail/releases"; 45 license = with licenses; if edition == "" then unfree else agpl3; 46 platforms = platforms.all; 47 maintainers = with maintainers; [ das_j ]; 48 }; 49 }); 50in { 51 rainloop-community = common { 52 edition = "community"; 53 sha256 = "sha256-25ScQ2OwSKAuqg8GomqDhpebhzQZjCk57h6MxUNiymc="; 54 }; 55 rainloop-standard = common { 56 edition = ""; 57 sha256 = "sha256-aYCwqFqhJEeakn4R0MUDGcSp+M47JbbCrbYaML8aeSs="; 58 }; 59}