unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Packaging LyX
@ 2017-12-22 15:44 Gammel Holte
  2017-12-22 18:42 ` ng0
  2017-12-22 19:48 ` Danny Milosavljevic
  0 siblings, 2 replies; 6+ messages in thread
From: Gammel Holte @ 2017-12-22 15:44 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2265 bytes --]

Hi all,

I'm planning to switch a dozen or so machines to GuixSD.

The only major package my users are missing is LyX (a LaTeX editor, see
https://www.lyx.org/) so I packaged it, and it works fine. See code below.

I would appreciate some help wrapping python. I'm familiar how to do this
in Nix, but not in Guix. Despite requiring a python interpreter for during
build, LyX dynamically looks for a python interpreter at runtime.
Obviously, it'd be desirable to link LyX to the python instance used as
input. For the record this is the LyX package in Nixpkgs:

https://github.com/NixOS/nixpkgs/blob/86da6d441f7a248b02d545ac1b2c90ef27f42d0b/pkgs/applications/misc/lyx/default.nix

I also had some doubts when packaging:

- Is a xz source preferred to a gz one?
- Nix uses qtcore and qtsvg as inputs, but if I use these in Guix (in place
of the whole qt) then LyX can't render its icons (svgz)

There are another minor TODOs:

- Transition to proper package and define-public syntax, as I was
installing with guix package -f
- Decide whether the package should live in tex.scm or elsewhere

Once this is done, I'm happy to submit a proper patch.

Thanks.

(use-modules
 (guix packages)
 (guix download)
 (guix build-system gnu)
 (guix licenses)
 (gnu packages algebra)
 (gnu packages compression)
 (gnu packages pkg-config)
 (gnu packages python)
 (gnu packages qt))

(package
 (name "lyx")
 (version "2.2.3")
 (source (origin
      (method url-fetch)
      (uri (string-append "ftp://ftp.lyx.org/pub/lyx/stable/2.2.x/lyx-"
                  version ".tar.gz"))
      (sha256
       (base32 "0xvaz0i371nn2ndinc0d3ywj76ivb62649a4sdgwbivisiahd2fj"))))
 (build-system gnu-build-system)
 (inputs `(("pkg-config" ,pkg-config)
       ("python" ,python-2)
       ("qt" ,qt)
       ("bc" ,bc)
       ("zlib" ,zlib)))
 (arguments `(#:configure-flags (list "--enable-qt5")))
 (home-page "http://www.lyx.org")
 (synopsis "An advanced WYSIWYM document processor and LaTeX front-end")
 (description "LyX is a document processor that encourages an approach
to writing based on the structure of your documents (WYSIWYM) and not
simply their appearance (WYSIWYG). LyX combines the power and
flexibility of TeX/LaTeX with the ease of use of a graphical
interface.")
 (license gpl2+))

[-- Attachment #2: Type: text/html, Size: 3118 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging LyX
  2017-12-22 15:44 Packaging LyX Gammel Holte
@ 2017-12-22 18:42 ` ng0
  2017-12-22 22:49   ` Gammel Holte
  2017-12-22 19:48 ` Danny Milosavljevic
  1 sibling, 1 reply; 6+ messages in thread
From: ng0 @ 2017-12-22 18:42 UTC (permalink / raw)
  To: Gammel Holte; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3492 bytes --]

Hi,

Gammel Holte transcribed 5.8K bytes:
> Hi all,
> 
> I'm planning to switch a dozen or so machines to GuixSD.
> 
> The only major package my users are missing is LyX (a LaTeX editor, see
> https://www.lyx.org/) so I packaged it, and it works fine. See code below.
> 
> I would appreciate some help wrapping python. I'm familiar how to do this
> in Nix, but not in Guix. Despite requiring a python interpreter for during
> build, LyX dynamically looks for a python interpreter at runtime.
> Obviously, it'd be desirable to link LyX to the python instance used as
> input. For the record this is the LyX package in Nixpkgs:
> 
> https://github.com/NixOS/nixpkgs/blob/86da6d441f7a248b02d545ac1b2c90ef27f42d0b/pkgs/applications/misc/lyx/default.nix
> 
> I also had some doubts when packaging:
> 
> - Is a xz source preferred to a gz one?

I would say it doesn't matter. For the files produced,
xz is smaller in most cases. Pick what you see fit.

> - Nix uses qtcore and qtsvg as inputs, but if I use these in Guix (in place
> of the whole qt) then LyX can't render its icons (svgz)

This shouldn't be a blocker. If it works with qt, that's okay. We
can strip it down to individual Qt modules later on.
Nix can be used as an inspiration but they do some things differently.

> There are another minor TODOs:
> 
> - Transition to proper package and define-public syntax, as I was
> installing with guix package -f
> - Decide whether the package should live in tex.scm or elsewhere

I think (gnu packages editors) or what the editor module is called again
would be better.

> Once this is done, I'm happy to submit a proper patch.
> 
> Thanks.
> 
> (use-modules
>  (guix packages)
>  (guix download)
>  (guix build-system gnu)
>  (guix licenses)
>  (gnu packages algebra)
>  (gnu packages compression)
>  (gnu packages pkg-config)
>  (gnu packages python)
>  (gnu packages qt))
> 
> (package
>  (name "lyx")
>  (version "2.2.3")
>  (source (origin
>       (method url-fetch)
>       (uri (string-append "ftp://ftp.lyx.org/pub/lyx/stable/2.2.x/lyx-"
>                   version ".tar.gz"))
>       (sha256
>        (base32 "0xvaz0i371nn2ndinc0d3ywj76ivb62649a4sdgwbivisiahd2fj"))))
>  (build-system gnu-build-system)
>  (inputs `(("pkg-config" ,pkg-config)
>        ("python" ,python-2)

Is this python-2 only? If not, could you explain why you picked 2 and not 3
(2 is on its way out in 20 months).

>        ("qt" ,qt)
>        ("bc" ,bc)
>        ("zlib" ,zlib)))
>  (arguments `(#:configure-flags (list "--enable-qt5")))
>  (home-page "http://www.lyx.org")
>  (synopsis "An advanced WYSIWYM document processor and LaTeX front-end")

I'd drop the "An" and simply write

  (synopsis "Advanced WYSIWYM document processor and LaTeX front-end")

>  (description "LyX is a document processor that encourages an approach
> to writing based on the structure of your documents (WYSIWYM) and not
> simply their appearance (WYSIWYG). LyX combines the power and
> flexibility of TeX/LaTeX with the ease of use of a graphical
> interface.")

You need to use two spaces between sentences here.

>  (license gpl2+))



Otherwise looks good to me with some indendation adjustments.
If you send a patch for master to a new bug ticket I can test it
and give additional feedback.

Thanks
-- 
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://c.n0.is/ng0_pubkeys/tree/keys
  WWW: https://n0.is

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging LyX
  2017-12-22 15:44 Packaging LyX Gammel Holte
  2017-12-22 18:42 ` ng0
@ 2017-12-22 19:48 ` Danny Milosavljevic
  2017-12-22 22:20   ` Gammel Holte
  1 sibling, 1 reply; 6+ messages in thread
From: Danny Milosavljevic @ 2017-12-22 19:48 UTC (permalink / raw)
  To: Gammel Holte; +Cc: guix-devel

Hmm, do the tests work for you? Back when I tried this was the blocker for me...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging LyX
  2017-12-22 19:48 ` Danny Milosavljevic
@ 2017-12-22 22:20   ` Gammel Holte
  0 siblings, 0 replies; 6+ messages in thread
From: Gammel Holte @ 2017-12-22 22:20 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 707 bytes --]

Danny Milosavljevic <dannym@scratchpost.org> wrote:

> Hmm, do the tests work for you? Back when I tried this was the blocker for
> me...
>

Yes, they work fine. Aside, I've tested LyX for a few days and everything
has worked as expected so far.

After looking into all documentation, packages from other distros, and
testing different things I'm pretty sure the minimal set of dependencies is
what I listed in my previous email.

Give the script attached a try if you want (still not a proper package, so
you need to do guix package -f lyx.scm). It also needs python@2.7 in the
environment as LyX doesn't bind to python properly, but rather tries to
find it dynamically during runtime. I need to fix that.

[-- Attachment #1.2: Type: text/html, Size: 1159 bytes --]

[-- Attachment #2: lyx.scm --]
[-- Type: text/x-scheme, Size: 1107 bytes --]

(use-modules
 (guix packages)
 (guix download)
 (guix build-system gnu)
 (guix licenses)
 (gnu packages algebra)
 (gnu packages compression)
 (gnu packages pkg-config)
 (gnu packages python)
 (gnu packages qt))

(package
 (name "lyx")
 (version "2.2.3")
 (source (origin
	  (method url-fetch)
	  (uri (string-append "ftp://ftp.lyx.org/pub/lyx/stable/2.2.x/lyx-"
			      version ".tar.gz"))
	  (sha256
	   (base32 "0xvaz0i371nn2ndinc0d3ywj76ivb62649a4sdgwbivisiahd2fj"))))
 (build-system gnu-build-system)
 (inputs `(("pkg-config" ,pkg-config)
	   ("python" ,python-2)
	   ("qt" ,qt)
	   ("bc" ,bc)
	   ("zlib" ,zlib)))
 (arguments `(#:configure-flags (list "--enable-qt5")))
 (home-page "http://www.lyx.org")
 (synopsis "An advanced WYSIWYM document processor and LaTeX front-end")
 (description "LyX is a document processor that encourages an approach
to writing based on the structure of your documents (WYSIWYM) and not
simply their appearance (WYSIWYG). LyX combines the power and
flexibility of TeX/LaTeX with the ease of use of a graphical
interface.")
 (license gpl2+))

;; wrap python
;; zlib lint

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging LyX
  2017-12-22 18:42 ` ng0
@ 2017-12-22 22:49   ` Gammel Holte
  2017-12-25 13:41     ` ng0
  0 siblings, 1 reply; 6+ messages in thread
From: Gammel Holte @ 2017-12-22 22:49 UTC (permalink / raw)
  To: guix-devel, ng0

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

On Fri, Dec 22, 2017 at 7:42 PM, ng0 <ng0@n0.is> wrote:

Thanks for your comments. I will address those before I circulate a patch.

> Is this python-2 only? If not, could you explain why you picked 2 and not
3
> (2 is on its way out in 20 months).

LyX is sadly not ready for Python 3 yet. It will be soon, but there are
still
tickets open to support it: https://www.lyx.org/trac/ticket/9006

Furthermore, I've tested LyX with Python 3 and it breaks.

Any hints on how to wrap the LyX package output so that it binds to the
Python input, instead of looking for it at runtime, like the Nix package
does?

https://github.com/NixOS/nixpkgs/blob/86da6d441f7a248b02d545ac1b2c90ef27f42d0b/pkgs/applications/misc/lyx/default.nix

[-- Attachment #2: Type: text/html, Size: 1104 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging LyX
  2017-12-22 22:49   ` Gammel Holte
@ 2017-12-25 13:41     ` ng0
  0 siblings, 0 replies; 6+ messages in thread
From: ng0 @ 2017-12-25 13:41 UTC (permalink / raw)
  To: Gammel Holte; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1644 bytes --]

Gammel Holte transcribed 2.0K bytes:
> On Fri, Dec 22, 2017 at 7:42 PM, ng0 <ng0@n0.is> wrote:
> 
> Thanks for your comments. I will address those before I circulate a patch.
> 
> > Is this python-2 only? If not, could you explain why you picked 2 and not
> 3
> > (2 is on its way out in 20 months).
> 
> LyX is sadly not ready for Python 3 yet. It will be soon, but there are
> still
> tickets open to support it: https://www.lyx.org/trac/ticket/9006
> 
> Furthermore, I've tested LyX with Python 3 and it breaks.

Okay, no problem.

> Any hints on how to wrap the LyX package output so that it binds to the
> Python input, instead of looking for it at runtime, like the Nix package
> does?
> 
> https://github.com/NixOS/nixpkgs/blob/86da6d441f7a248b02d545ac1b2c90ef27f42d0b/pkgs/applications/misc/lyx/default.nix

It depends. I have no time to look at the code (to see where python
is required, how much of it (modules etc)), but we have multiple
options, including:

1. Wrap the program. One of many examples:
   https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/gnuzilla.scm#n759
2. patch calls of 'python' to the gnu-store python executable. I can see this
   failing if python modules are required to be present and not just python.
3. Search for 'wrap' in the source checkout of Guix. You will find commits like
   0498d24866c4955faee95a4fc19ff6817e5483d2 
  (https://git.savannah.gnu.org/cgit/guix.git/commit/gnu/packages?id=0498d24866c4955faee95a4fc19ff6817e5483d2)

-- 
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://c.n0.is/ng0_pubkeys/tree/keys
  WWW: https://n0.is

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-25 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-22 15:44 Packaging LyX Gammel Holte
2017-12-22 18:42 ` ng0
2017-12-22 22:49   ` Gammel Holte
2017-12-25 13:41     ` ng0
2017-12-22 19:48 ` Danny Milosavljevic
2017-12-22 22:20   ` Gammel Holte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).