aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/servers/rainloop/default.nix
blob: 42c68d5608edb00b401f0bb3ef8493655cbbcc9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ 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 stdenv.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";
  };
}