2021-01-17 03:09:27 +01:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, lua, file, ncurses, gmime, pcre-cpp
|
2018-03-11 16:59:29 +01:00
|
|
|
, perl, perlPackages, makeWrapper
|
2018-03-11 13:43:50 +01:00
|
|
|
, debugBuild ? false
|
|
|
|
, alternativeGlobalConfigFilePath ? null
|
|
|
|
}:
|
2017-02-17 10:11:03 +01:00
|
|
|
|
|
|
|
let
|
2018-03-11 13:43:50 +01:00
|
|
|
version = "3.1";
|
|
|
|
binaryName = if debugBuild then "lumail2-debug" else "lumail2";
|
|
|
|
alternativeConfig = builtins.toFile "lumail2.lua"
|
|
|
|
(builtins.readFile alternativeGlobalConfigFilePath);
|
|
|
|
|
2019-04-24 05:48:22 +02:00
|
|
|
globalConfig = if alternativeGlobalConfigFilePath == null then ''
|
2018-03-11 13:43:50 +01:00
|
|
|
mkdir -p $out/etc/lumail2
|
|
|
|
cp global.config.lua $out/etc/lumail2.lua
|
|
|
|
for n in ./lib/*.lua; do
|
|
|
|
cp "$n" $out/etc/lumail2/
|
|
|
|
done
|
|
|
|
'' else ''
|
|
|
|
ln -s ${alternativeConfig} $out/etc/lumail2.lua
|
|
|
|
'';
|
|
|
|
|
|
|
|
getPath = type : "${lua}/lib/?.${type};";
|
|
|
|
luaPath = getPath "lua";
|
|
|
|
luaCPath = getPath "so";
|
2017-02-17 10:11:03 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2019-08-13 23:52:01 +02:00
|
|
|
pname = "lumail";
|
|
|
|
inherit version;
|
2017-02-17 10:11:03 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://lumail.org/download/lumail-${version}.tar.gz";
|
2017-12-15 14:34:28 +01:00
|
|
|
sha256 = "0vj7p7f02m3w8wb74ilajcwznc4ai4h2ikkz9ildy0c00aqsi5w4";
|
2017-02-17 10:11:03 +01:00
|
|
|
};
|
|
|
|
|
2018-03-11 13:43:50 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-17 03:09:27 +01:00
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
2017-02-17 10:11:03 +01:00
|
|
|
buildInputs = [
|
2018-03-11 16:59:29 +01:00
|
|
|
lua file ncurses gmime pcre-cpp
|
2017-02-17 10:11:03 +01:00
|
|
|
perl perlPackages.JSON perlPackages.NetIMAPClient
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
sed -e 's|"/etc/lumail2|LUMAIL_LUAPATH"/..|' -i src/lumail2.cc src/imap_proxy.cc
|
|
|
|
|
|
|
|
perlFlags=
|
|
|
|
for i in $(IFS=:; echo $PERL5LIB); do
|
|
|
|
perlFlags="$perlFlags -I$i"
|
|
|
|
done
|
|
|
|
|
|
|
|
sed -e "s|^#\!\(.*/perl.*\)$|#\!\1$perlFlags|" -i perl.d/imap-proxy
|
|
|
|
'';
|
|
|
|
|
2021-01-15 06:42:41 +01:00
|
|
|
buildFlags = lib.optional debugBuild "lumail2-debug";
|
2018-03-11 13:43:50 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin || true
|
|
|
|
install -m755 ${binaryName} $out/bin/
|
|
|
|
''
|
|
|
|
+ globalConfig
|
|
|
|
+ ''
|
|
|
|
wrapProgram $out/bin/${binaryName} \
|
|
|
|
--prefix LUA_PATH : "${luaPath}" \
|
|
|
|
--prefix LUA_CPATH : "${luaCPath}"
|
|
|
|
'';
|
|
|
|
|
2017-02-17 10:11:03 +01:00
|
|
|
makeFlags = [
|
|
|
|
"LVER=lua"
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"SYSCONFDIR=$(out)/etc"
|
2018-03-11 13:43:50 +01:00
|
|
|
"LUMAIL_LIBS=$(out)/etc/lumail2"
|
2017-02-17 10:11:03 +01:00
|
|
|
];
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2017-02-17 10:11:03 +01:00
|
|
|
description = "Console-based email client";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://lumail.org/";
|
2017-02-17 10:11:03 +01:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [orivej];
|
|
|
|
};
|
|
|
|
}
|