13e95f33db
This is necessary because the standard library which is distributed with lumail (the lumail core configuration so to speak) is written for lua5.1 apparently. The website states 5.1 or 5.2 or 5.3, but 5.2 fails because "loadstring" was deprecated in lua 5.2. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
82 lines
2.1 KiB
Nix
82 lines
2.1 KiB
Nix
{ stdenv, fetchurl, pkgconfig, lua, file, ncurses, gmime, pcre-cpp
|
|
, perl, perlPackages, makeWrapper
|
|
, debugBuild ? false
|
|
, alternativeGlobalConfigFilePath ? null
|
|
}:
|
|
|
|
let
|
|
version = "3.1";
|
|
binaryName = if debugBuild then "lumail2-debug" else "lumail2";
|
|
alternativeConfig = builtins.toFile "lumail2.lua"
|
|
(builtins.readFile alternativeGlobalConfigFilePath);
|
|
|
|
globalConfig = if isNull alternativeGlobalConfigFilePath then ''
|
|
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";
|
|
in
|
|
stdenv.mkDerivation {
|
|
name = "lumail-${version}";
|
|
|
|
src = fetchurl {
|
|
url = "https://lumail.org/download/lumail-${version}.tar.gz";
|
|
sha256 = "0vj7p7f02m3w8wb74ilajcwznc4ai4h2ikkz9ildy0c00aqsi5w4";
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
nativeBuildInputs = [ pkgconfig makeWrapper ];
|
|
buildInputs = [
|
|
lua file ncurses gmime pcre-cpp
|
|
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
|
|
'';
|
|
|
|
buildFlags = if debugBuild then "lumail2-debug" else "";
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin || true
|
|
install -m755 ${binaryName} $out/bin/
|
|
''
|
|
+ globalConfig
|
|
+ ''
|
|
wrapProgram $out/bin/${binaryName} \
|
|
--prefix LUA_PATH : "${luaPath}" \
|
|
--prefix LUA_CPATH : "${luaCPath}"
|
|
'';
|
|
|
|
makeFlags = [
|
|
"LVER=lua"
|
|
"PREFIX=$(out)"
|
|
"SYSCONFDIR=$(out)/etc"
|
|
"LUMAIL_LIBS=$(out)/etc/lumail2"
|
|
];
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "Console-based email client";
|
|
homepage = https://lumail.org/;
|
|
license = licenses.gpl2;
|
|
platforms = platforms.linux;
|
|
maintainers = with maintainers; [orivej];
|
|
};
|
|
}
|