mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-22 05:19:00 +02:00
lumail: Fix package definition
Includes: * Package gets a flag to use the debug build * install phase installs all lua scripts from the package and makes lumail find them * global configuration which is shipped with the package can be overridden, if desired * parallel building enabled
This commit is contained in:
parent
29c33ba5af
commit
bb8e1c4512
|
@ -1,8 +1,28 @@
|
||||||
{ stdenv, fetchurl, pkgconfig, lua5_2, file, ncurses, gmime, pcre-cpp
|
{ stdenv, fetchurl, pkgconfig, lua5_2, file, ncurses, gmime, pcre-cpp
|
||||||
, perl, perlPackages }:
|
, perl, perlPackages
|
||||||
|
, debugBuild ? false
|
||||||
|
, alternativeGlobalConfigFilePath ? null
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "3.1";
|
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
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "lumail-${version}";
|
name = "lumail-${version}";
|
||||||
|
@ -12,7 +32,9 @@ stdenv.mkDerivation {
|
||||||
sha256 = "0vj7p7f02m3w8wb74ilajcwznc4ai4h2ikkz9ildy0c00aqsi5w4";
|
sha256 = "0vj7p7f02m3w8wb74ilajcwznc4ai4h2ikkz9ildy0c00aqsi5w4";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgconfig makeWrapper ];
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
lua5_2 file ncurses gmime pcre-cpp
|
lua5_2 file ncurses gmime pcre-cpp
|
||||||
perl perlPackages.JSON perlPackages.NetIMAPClient
|
perl perlPackages.JSON perlPackages.NetIMAPClient
|
||||||
|
@ -29,16 +51,26 @@ stdenv.mkDerivation {
|
||||||
sed -e "s|^#\!\(.*/perl.*\)$|#\!\1$perlFlags|" -i perl.d/imap-proxy
|
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 = [
|
makeFlags = [
|
||||||
"LVER=lua"
|
"LVER=lua"
|
||||||
"PREFIX=$(out)"
|
"PREFIX=$(out)"
|
||||||
"SYSCONFDIR=$(out)/etc"
|
"SYSCONFDIR=$(out)/etc"
|
||||||
|
"LUMAIL_LIBS=$(out)/etc/lumail2"
|
||||||
];
|
];
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
cp lumail2.user.lua $out/etc/lumail2/
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Console-based email client";
|
description = "Console-based email client";
|
||||||
homepage = https://lumail.org/;
|
homepage = https://lumail.org/;
|
||||||
|
|
Loading…
Reference in a new issue