From 29c33ba5af01fbce3aa255dac2328c50a4a1a745 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 15 Dec 2017 14:34:28 +0100 Subject: [PATCH 1/3] lumail: 2.9 -> 3.1 --- pkgs/applications/networking/mailreaders/lumail/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/mailreaders/lumail/default.nix b/pkgs/applications/networking/mailreaders/lumail/default.nix index 2c1678e994fb..ff85c98d9702 100644 --- a/pkgs/applications/networking/mailreaders/lumail/default.nix +++ b/pkgs/applications/networking/mailreaders/lumail/default.nix @@ -2,14 +2,14 @@ , perl, perlPackages }: let - version = "2.9"; + version = "3.1"; in stdenv.mkDerivation { name = "lumail-${version}"; src = fetchurl { url = "https://lumail.org/download/lumail-${version}.tar.gz"; - sha256 = "1rni5lbic36v4cd1r0l28542x0hlmfqkl6nac79gln491in2l2sc"; + sha256 = "0vj7p7f02m3w8wb74ilajcwznc4ai4h2ikkz9ildy0c00aqsi5w4"; }; nativeBuildInputs = [ pkgconfig ]; From bb8e1c4512e6556dfc46fc9af10d005599b84b7f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 11 Mar 2018 13:43:50 +0100 Subject: [PATCH 2/3] 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 --- .../networking/mailreaders/lumail/default.nix | 46 ++++++++++++++++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/networking/mailreaders/lumail/default.nix b/pkgs/applications/networking/mailreaders/lumail/default.nix index ff85c98d9702..5a333c8d982c 100644 --- a/pkgs/applications/networking/mailreaders/lumail/default.nix +++ b/pkgs/applications/networking/mailreaders/lumail/default.nix @@ -1,8 +1,28 @@ { stdenv, fetchurl, pkgconfig, lua5_2, file, ncurses, gmime, pcre-cpp -, perl, perlPackages }: +, perl, perlPackages +, debugBuild ? false +, alternativeGlobalConfigFilePath ? null +}: 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 stdenv.mkDerivation { name = "lumail-${version}"; @@ -12,7 +32,9 @@ stdenv.mkDerivation { sha256 = "0vj7p7f02m3w8wb74ilajcwznc4ai4h2ikkz9ildy0c00aqsi5w4"; }; - nativeBuildInputs = [ pkgconfig ]; + enableParallelBuilding = true; + + nativeBuildInputs = [ pkgconfig makeWrapper ]; buildInputs = [ lua5_2 file ncurses gmime pcre-cpp perl perlPackages.JSON perlPackages.NetIMAPClient @@ -29,16 +51,26 @@ stdenv.mkDerivation { 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" ]; - postInstall = '' - cp lumail2.user.lua $out/etc/lumail2/ - ''; - meta = with stdenv.lib; { description = "Console-based email client"; homepage = https://lumail.org/; From 13e95f33db894f7d7a46f1ffe054fe56ba83b030 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 11 Mar 2018 16:59:29 +0100 Subject: [PATCH 3/3] lumail: Use lua5.1 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 --- pkgs/applications/networking/mailreaders/lumail/default.nix | 6 +++--- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/mailreaders/lumail/default.nix b/pkgs/applications/networking/mailreaders/lumail/default.nix index 5a333c8d982c..79deab46912b 100644 --- a/pkgs/applications/networking/mailreaders/lumail/default.nix +++ b/pkgs/applications/networking/mailreaders/lumail/default.nix @@ -1,5 +1,5 @@ -{ stdenv, fetchurl, pkgconfig, lua5_2, file, ncurses, gmime, pcre-cpp -, perl, perlPackages +{ stdenv, fetchurl, pkgconfig, lua, file, ncurses, gmime, pcre-cpp +, perl, perlPackages, makeWrapper , debugBuild ? false , alternativeGlobalConfigFilePath ? null }: @@ -36,7 +36,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ pkgconfig makeWrapper ]; buildInputs = [ - lua5_2 file ncurses gmime pcre-cpp + lua file ncurses gmime pcre-cpp perl perlPackages.JSON perlPackages.NetIMAPClient ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7b3d29ce57ea..3bca52f729c7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16440,7 +16440,9 @@ with pkgs; looking-glass-client = callPackage ../applications/virtualization/looking-glass-client { }; - lumail = callPackage ../applications/networking/mailreaders/lumail { }; + lumail = callPackage ../applications/networking/mailreaders/lumail { + lua = lua5_1; + }; lv2bm = callPackage ../applications/audio/lv2bm { };