mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
60 lines
1.7 KiB
Nix
60 lines
1.7 KiB
Nix
{ lib, stdenv, fetchurl, unzip, pkgs, dataPath ? "/var/lib/rainloop" }: let
|
|
common = { edition, sha256 }:
|
|
stdenv.mkDerivation (rec {
|
|
pname = "rainloop${stdenv.lib.optionalString (edition != "") "-${edition}"}";
|
|
version = "1.14.0";
|
|
|
|
buildInputs = [ unzip ];
|
|
|
|
unpackPhase = ''
|
|
mkdir rainloop
|
|
unzip -q -d rainloop $src
|
|
'';
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/RainLoop/rainloop-webmail/releases/download/v${version}/rainloop-${edition}${stdenv.lib.optionalString (edition != "") "-"}${version}.zip";
|
|
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;
|
|
}
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir $out
|
|
cp -r rainloop/* $out
|
|
rm -rf $out/data
|
|
cp ${includeScript} $out/include.php
|
|
mkdir $out/data
|
|
chmod 700 $out/data
|
|
'';
|
|
|
|
meta = with lib; {
|
|
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;
|
|
platforms = platforms.all;
|
|
maintainers = with maintainers; [ das_j ];
|
|
};
|
|
});
|
|
in {
|
|
rainloop-community = common {
|
|
edition = "community";
|
|
sha256 = "0a8qafm4khwj8cnaiaxvjb9073w6fr63vk1b89nks4hmfv10jn6y";
|
|
};
|
|
rainloop-standard = common {
|
|
edition = "";
|
|
sha256 = "0961g4mci080f7y98zx9r4qw620l4z3na1ivvlyhhr1v4dywqvch";
|
|
};
|
|
}
|