@@ -1,20 +1,42 @@
1−{ stdenv, fetchurl, pkgconfig, lua5_2, file, ncurses, gmime, pcre-cpp
1+{ stdenv, fetchurl, pkgconfig, lua, file, ncurses, gmime, pcre-cpp
2−, perl, perlPackages }:
2+, perl, perlPackages, makeWrapper
4+, alternativeGlobalConfigFilePath ? null
5− version = "2.9";
8+ version = "3.1";
9+ binaryName = if debugBuild then "lumail2-debug" else "lumail2";
10+ alternativeConfig = builtins.toFile "lumail2.lua"
11+ (builtins.readFile alternativeGlobalConfigFilePath);
13+ globalConfig = if isNull alternativeGlobalConfigFilePath then ''
14+ mkdir -p $out/etc/lumail2
15+ cp global.config.lua $out/etc/lumail2.lua
16+ for n in ./lib/*.lua; do
17+ cp "$n" $out/etc/lumail2/
20+ ln -s ${alternativeConfig} $out/etc/lumail2.lua
23+ getPath = type : "${lua}/lib/?.${type};";
24+ luaPath = getPath "lua";
25+ luaCPath = getPath "so";
7stdenv.mkDerivation {
27stdenv.mkDerivation {
8 name = "lumail-${version}";
28 name = "lumail-${version}";
10 src = fetchurl {
30 src = fetchurl {
11 url = "https://lumail.org/download/lumail-${version}.tar.gz";
31 url = "https://lumail.org/download/lumail-${version}.tar.gz";
12− sha256 = "1rni5lbic36v4cd1r0l28542x0hlmfqkl6nac79gln491in2l2sc";
32+ sha256 = "0vj7p7f02m3w8wb74ilajcwznc4ai4h2ikkz9ildy0c00aqsi5w4";
35+ enableParallelBuilding = true;
15− nativeBuildInputs = [ pkgconfig ];
37+ nativeBuildInputs = [ pkgconfig makeWrapper ];
16 buildInputs = [
38 buildInputs = [
17− lua5_2 file ncurses gmime pcre-cpp
39+ lua file ncurses gmime pcre-cpp
18 perl perlPackages.JSON perlPackages.NetIMAPClient
40 perl perlPackages.JSON perlPackages.NetIMAPClient
@@ -29,16 +51,26 @@ stdenv.mkDerivation {
29 sed -e "s|^#\!\(.*/perl.*\)$|#\!\1$perlFlags|" -i perl.d/imap-proxy
51 sed -e "s|^#\!\(.*/perl.*\)$|#\!\1$perlFlags|" -i perl.d/imap-proxy
54+ buildFlags = if debugBuild then "lumail2-debug" else "";
57+ mkdir -p $out/bin || true
58+ install -m755 ${binaryName} $out/bin/
62+ wrapProgram $out/bin/${binaryName} \
63+ --prefix LUA_PATH : "${luaPath}" \
64+ --prefix LUA_CPATH : "${luaCPath}"
32 makeFlags = [
67 makeFlags = [
33 "LVER=lua"
68 "LVER=lua"
34 "PREFIX=$(out)"
69 "PREFIX=$(out)"
35 "SYSCONFDIR=$(out)/etc"
70 "SYSCONFDIR=$(out)/etc"
71+ "LUMAIL_LIBS=$(out)/etc/lumail2"
39− cp lumail2.user.lua $out/etc/lumail2/
42 meta = with stdenv.lib; {
74 meta = with stdenv.lib; {
43 description = "Console-based email client";
75 description = "Console-based email client";
44 homepage = https://lumail.org/;
76 homepage = https://lumail.org/;