nixpkgs-suyu/pkgs/servers/rainloop/default.nix

60 lines
1.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, unzip, pkgs, dataPath ? "/var/lib/rainloop" }: let
2018-06-28 21:54:44 +02:00
common = { edition, sha256 }:
stdenv.mkDerivation (rec {
2021-01-15 08:07:56 +01:00
pname = "rainloop${lib.optionalString (edition != "") "-${edition}"}";
2021-06-11 09:20:23 +02:00
version = "1.16.0";
2018-06-28 21:54:44 +02:00
nativeBuildInputs = [ unzip ];
2018-06-28 21:54:44 +02:00
unpackPhase = ''
mkdir rainloop
unzip -q -d rainloop $src
'';
src = fetchurl {
2021-01-15 08:07:56 +01:00
url = "https://github.com/RainLoop/rainloop-webmail/releases/download/v${version}/rainloop-${edition}${lib.optionalString (edition != "") "-"}${version}.zip";
2018-06-28 21:54:44 +02:00
sha256 = sha256;
};
includeScript = pkgs.writeText "include.php" ''
<?php
/**
* @return string
*/
function __get_custom_data_full_path()
{
$v = getenv('RAINLOOP_DATA_DIR', TRUE);
return $v === FALSE ? '${dataPath}' : $v;
}
'';
2018-06-28 21:54:44 +02:00
installPhase = ''
mkdir $out
cp -r rainloop/* $out
rm -rf $out/data
cp ${includeScript} $out/include.php
mkdir $out/data
chmod 700 $out/data
2018-06-28 21:54:44 +02:00
'';
meta = with lib; {
2018-06-28 21:54:44 +02: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;
2018-06-28 21:54:44 +02:00
platforms = platforms.all;
maintainers = with maintainers; [ das_j ];
};
});
in {
rainloop-community = common {
edition = "community";
2021-06-11 09:20:23 +02:00
sha256 = "sha256-25ScQ2OwSKAuqg8GomqDhpebhzQZjCk57h6MxUNiymc=";
};
rainloop-standard = common {
edition = "";
2021-06-11 09:20:23 +02:00
sha256 = "sha256-aYCwqFqhJEeakn4R0MUDGcSp+M47JbbCrbYaML8aeSs=";
};
}