diff mbox

[7/7] gnu: Add prosody.

Message ID 20160822193918.27397-8-rekado@elephly.net
State New
Headers show

Commit Message

Ricardo Wurmus Aug. 22, 2016, 7:39 p.m. UTC
* gnu/packages/messaging.scm (prosody): New variable.
---
 gnu/packages/messaging.scm | 78 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 76 insertions(+), 2 deletions(-)

Comments

Leo Famulari Aug. 23, 2016, 1:33 a.m. UTC | #1
On Mon, Aug 22, 2016 at 09:39:18PM +0200, Ricardo Wurmus wrote:
> * gnu/packages/messaging.scm (prosody): New variable.

> +    (inputs
> +     `(("libidn" ,libidn)
> +       ("openssl" ,openssl)
> +       ("lua" ,lua-5.1)
> +       ("lua-expat" ,lua5.1-expat)
> +       ("lua-socket" ,lua5.1-socket)
> +       ("lua-filesystem" ,lua5.1-filesystem)
> +       ("lua-sec" ,lua5.1-sec)))

I used `guix environment --ad-hoc` to put prosody in my environment, and
then I ran it without any configuration. It created the log file
'prosody.err', which contained this line, twice:

Aug 22 21:31:33 localhost:tls   error   Unable to initialize TLS: LuaSec (required for encryption) was not found
Ricardo Wurmus Aug. 28, 2016, 10:37 a.m. UTC | #2
Leo Famulari <leo@famulari.name> writes:

> On Mon, Aug 22, 2016 at 09:39:18PM +0200, Ricardo Wurmus wrote:
>> * gnu/packages/messaging.scm (prosody): New variable.
>
>> +    (inputs
>> +     `(("libidn" ,libidn)
>> +       ("openssl" ,openssl)
>> +       ("lua" ,lua-5.1)
>> +       ("lua-expat" ,lua5.1-expat)
>> +       ("lua-socket" ,lua5.1-socket)
>> +       ("lua-filesystem" ,lua5.1-filesystem)
>> +       ("lua-sec" ,lua5.1-sec)))
>
> I used `guix environment --ad-hoc` to put prosody in my environment, and
> then I ran it without any configuration. It created the log file
> 'prosody.err', which contained this line, twice:
>
> Aug 22 21:31:33 localhost:tls   error   Unable to initialize TLS: LuaSec (required for encryption) was not found

Hmm, I see the same.  I don’t know why this happens.  With LUA_CPATH and
LUA_PATH set as they are in the wrapper I can load the “ssl” module just
fine.


./pre-inst-env guix environment --ad-hoc lua@5.1 lua5.1-sec
export LUA_PATH="/gnu/store/y9qhxky4dcgaiar7cw3fkzy8b4nqdx4z-prosody-0.9.10/share/lua/5.1/?.lua;/gnu/store/y9qhxky4dcgaiar7cw3fkzy8b4nqdx4z-prosody-0.9.10/share/lua/5.1/?/?.lua;/gnu/store/j5xs64837lcab0nkhywlq22gvbcgg2wy-lua-5.1.5/share/lua/5.1/?.lua;/gnu/store/j5xs64837lcab0nkhywlq22gvbcgg2wy-lua-5.1.5/share/lua/5.1/?/?.lua;/gnu/store/chl4bnz42nsjplvhq1vz91y0i1n4b35c-lua5.1-expat-1.3.0/share/lua/5.1/?.lua;/gnu/store/chl4bnz42nsjplvhq1vz91y0i1n4b35c-lua5.1-expat-1.3.0/share/lua/5.1/?/?.lua;/gnu/store/129p6qd6ffqq36zilgxancigaa201qqv-lua5.1-socket-2.0.2/share/lua/5.1/?.lua;/gnu/store/129p6qd6ffqq36zilgxancigaa201qqv-lua5.1-socket-2.0.2/share/lua/5.1/?/?.lua;/gnu/store/3g6p2qq0y4nz9q9wx6am9sadhifxsabv-lua5.1-filesystem-1.6.3/share/lua/5.1/?.lua;/gnu/store/3g6p2qq0y4nz9q9wx6am9sadhifxsabv-lua5.1-filesystem-1.6.3/share/lua/5.1/?/?.lua;/gnu/store/bvf9yz1xci6i811ls37aji9w71fxhx8y-lua5.1-sec-0.6/share/lua/5.1/?.lua;/gnu/store/bvf9yz1xci6i811ls37aji9w71fxhx8y-lua5.1-sec-0.6/share/lua/5.1/?/?.lua"
export
LUA_CPATH="/gnu/store/y9qhxky4dcgaiar7cw3fkzy8b4nqdx4z-prosody-0.9.10/lib/lua/5.1/?.so;/gnu/store/y9qhxky4dcgaiar7cw3fkzy8b4nqdx4z-prosody-0.9.10/lib/lua/5.1/?/?.so;/gnu/store/j5xs64837lcab0nkhywlq22gvbcgg2wy-lua-5.1.5/lib/lua/5.1/?.so;/gnu/store/j5xs64837lcab0nkhywlq22gvbcgg2wy-lua-5.1.5/lib/lua/5.1/?/?.so;/gnu/store/chl4bnz42nsjplvhq1vz91y0i1n4b35c-lua5.1-expat-1.3.0/lib/lua/5.1/?.so;/gnu/store/chl4bnz42nsjplvhq1vz91y0i1n4b35c-lua5.1-expat-1.3.0/lib/lua/5.1/?/?.so;/gnu/store/129p6qd6ffqq36zilgxancigaa201qqv-lua5.1-socket-2.0.2/lib/lua/5.1/?.so;/gnu/store/129p6qd6ffqq36zilgxancigaa201qqv-lua5.1-socket-2.0.2/lib/lua/5.1/?/?.so;/gnu/store/3g6p2qq0y4nz9q9wx6am9sadhifxsabv-lua5.1-filesystem-1.6.3/lib/lua/5.1/?.so;/gnu/store/3g6p2qq0y4nz9q9wx6am9sadhifxsabv-lua5.1-filesystem-1.6.3/lib/lua/5.1/?/?.so;/gnu/store/bvf9yz1xci6i811ls37aji9w71fxhx8y-lua5.1-sec-0.6/lib/lua/5.1/?.so;/gnu/store/bvf9yz1xci6i811ls37aji9w71fxhx8y-lua5.1-sec-0.6/lib/lua/5.1/?/?.so"
lua

Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> require "ssl"
> ssl_available = pcall(require, "ssl");
> print(ssl_available);
true


The error is reported in “core/certmanager.lua” in the function
“create_context”, which contains this line:

  	if not ssl then return nil, "LuaSec (required for encryption) was not found"; end

“ssl” doesn’t appear to be defined anywhere.  At the top of the file
it’s just “local ssl = ssl;”.

LuaSec is found by “util/dependencies.lua” or else we would see a
complaint printed to stdout upon application start.

Archlinux users also reported problems with latest prosody and latest
luasec: https://bugs.archlinux.org/task/48480

This makes me think that this is not a problem with this package per se,
but with Prosody.

~~ Ricardo
Leo Famulari Aug. 30, 2016, 1:36 a.m. UTC | #3
On Sun, Aug 28, 2016 at 12:37:42PM +0200, Ricardo Wurmus wrote:
> LuaSec is found by “util/dependencies.lua” or else we would see a
> complaint printed to stdout upon application start.
> 
> Archlinux users also reported problems with latest prosody and latest
> luasec: https://bugs.archlinux.org/task/48480
> 
> This makes me think that this is not a problem with this package per se,
> but with Prosody.

Okay, hopefully there is a fix available soon!
diff mbox

Patch

diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index de9ac17..2f81ff8 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -3,7 +3,7 @@ 
 ;;; Copyright © 2014 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -24,7 +24,7 @@ 
 (define-module (gnu packages messaging)
   #:use-module ((guix licenses)
                 #:select (gpl3+ gpl2+ gpl2 lgpl2.1 lgpl2.0+ bsd-2 non-copyleft
-                          asl2.0))
+                          asl2.0 x11))
   #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -45,6 +45,7 @@ 
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages libcanberra)
   #:use-module (gnu packages libidn)
+  #:use-module (gnu packages lua)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages ncurses)
@@ -492,4 +493,77 @@  transformation; audio and video conferences; file transfer; TLS, GPG and
 end-to-end encryption support; XML console.")
     (license gpl3+)))
 
+(define-public prosody
+  (package
+    (name "prosody")
+    (version "0.9.10")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://prosody.im/downloads/source/"
+                                  "prosody-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0bv6s5c0iizz015hh1lxlwlw1iwvisywajm2rcrbdfyrskzfwdj8"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; no "check" target
+       #:modules ((ice-9 match)
+                  (srfi srfi-1)
+                  (guix build gnu-build-system)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-configure-script
+           (lambda _
+             ;; The configure script aborts when it encounters unexpected
+             ;; arguments.  Make it more tolerant.
+             (substitute* "configure"
+               (("exit 1") ""))
+             #t))
+         (add-after 'install 'wrap-programs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Make sure all executables in "bin" find the required Lua
+             ;; modules at runtime.
+             (let* ((out   (assoc-ref outputs "out"))
+                    (bin   (string-append out "/bin/"))
+                    (deps  (delete #f (map (match-lambda
+                                             ((label . directory)
+                                              (if (string-prefix? "lua-" label)
+                                                  directory #f)))
+                                           inputs)))
+                    (path  (string-join
+                            (map (lambda (path)
+                                   (string-append path "/share/lua/5.1/?.lua;"
+                                                  path "/share/lua/5.1/?/?.lua"))
+                                 (cons out deps))
+                            ";"))
+                    (cpath (string-join
+                            (map (lambda (path)
+                                   (string-append path "/lib/lua/5.1/?.so;"
+                                                  path "/lib/lua/5.1/?/?.so"))
+                                 (cons out deps))
+                            ";")))
+               (for-each (lambda (file)
+                           (wrap-program file
+                             `("LUA_PATH"  ";" = (,path))
+                             `("LUA_CPATH" ";" = (,cpath))))
+                         (find-files bin ".*"))
+               #t))))))
+    (inputs
+     `(("libidn" ,libidn)
+       ("openssl" ,openssl)
+       ("lua" ,lua-5.1)
+       ("lua-expat" ,lua5.1-expat)
+       ("lua-socket" ,lua5.1-socket)
+       ("lua-filesystem" ,lua5.1-filesystem)
+       ("lua-sec" ,lua5.1-sec)))
+    (home-page "https://prosody.im/")
+    (synopsis "Jabber (XMPP) server")
+    (description "Prosody is a modern XMPP communication server.  It aims to
+be easy to set up and configure, and efficient with system resources.
+Additionally, for developers it aims to be easy to extend and give a flexible
+system on which to rapidly develop added functionality, or prototype new
+protocols.")
+    (license x11)))
+
 ;;; messaging.scm ends here