guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guix packages


From: Ludovic Courtès
Subject: Re: guix packages
Date: Mon, 25 Aug 2014 20:46:29 +0200
User-agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux)

Hello,

Just to complete Andreas’s response: there actually is a tool to import
package definitions from Nixpkgs, but it’s only stealthily mentioned in
the manual.  However, it only imports the skeleton and not all the
details:

--8<---------------cut here---------------start------------->8---
$ guix import ~/src/nixpkgs guile
;;; SSAX warning: Skipping PI: xml

trace: lib.zip is deprecated, use lib.zipAttrsWith instead
trace: `mkStrict' is obsolete; use `mkOverride 0' instead.
trace: `types.list' is deprecated; use `types.listOf' instead
;; converted from 
/home/ludo/src/nixpkgs/pkgs/development/interpreters/guile/default.nix:10

(package
  (name "guile")
  (version "2.0.9")
  (source
    (origin
      (method url-fetch)
      (uri (string-append
             "mirror://gnu/guile/guile-"
             version
             ".tar.xz"))
      (sha256
        (base32
          "0nw9y8vjyz4r61v06p9msks5lm58pd91irmzg4k487vmv743h2pp"))))
  (build-system gnu-build-system)
  (inputs
    `(("libffi" ,libffi)
      ("libunistring" ,libunistring)
      ("libtool" ,libtool)
      ("readline" ,readline)
      ("pkg-config" ,pkg-config)
      ("gawk" ,gawk)
      ("hook" ,hook)))
  (propagated-inputs
    `(("libunistring" ,libunistring)
      ("libtool" ,libtool)
      ("boehm-gc" ,boehm-gc)
      ("gmp" ,gmp)))
  (home-page "http://www.gnu.org/software/guile/";)
  (synopsis
    "GNU Guile 2.0, an embeddable Scheme implementation")
  (description
    "GNU Guile is an implementation of the Scheme programming language, with
support for many SRFIs, packaged for use in a wide variety of
environments.  In addition to implementing the R5RS Scheme standard
and a large subset of R6RS, Guile includes a module system, full access
to POSIX system calls, networking support, multiple threads, dynamic
linking, a foreign function call interface, and powerful string
processing.
")
  (license
    (attribute-set
      ((attribute
         #<<location> file: "/home/ludo/src/nixpkgs/lib/licenses.nix" line: 
"197" column: "5">
         "fullName"
         "GNU Lesser General Public License version 3 or later")
       (attribute
         #<<location> file: "/home/ludo/src/nixpkgs/lib/licenses.nix" line: 
"196" column: "5">
         "shortName"
         "LGPLv3+")
       (attribute
         #<<location> file: "/home/ludo/src/nixpkgs/lib/licenses.nix" line: 
"198" column: "5">
         "url"
         "http://www.fsf.org/licensing/licenses/lgpl.html";)))))
--8<---------------cut here---------------end--------------->8---

Apart from the license SNAFU, it actually works.  ;-)  (It works by
invoking ‘nix-instantiate’, so Nix must be installed.)

But if you look at the original definition in guile/default.nix, you’ll
notice that it contains things like this:

--8<---------------cut here---------------start------------->8---
  # don't have "libgcc_s.so.1" on darwin
  LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";

  postInstall = ''
    wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"

    # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for
    # why `--with-libunistring-prefix' and similar options coming from
    # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64.
    sed -i "$out/lib/pkgconfig/guile-2.0.pc"    \
        -e 's|-lunistring|-L${libunistring}/lib -lunistring|g ;
            s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ;
            s|-lltdl|-L${libtool}/lib -lltdl|g'
  '';
--8<---------------cut here---------------end--------------->8---

The ‘LDFLAGS’ setting defines ‘LDFLAGS’ as an environment variable in
the build process, and the ‘postInstall’ thing defines a ‘postInstall’
environment variable, which Nixpkgs’s build tool, written in Bash, will
‘eval’.

This differs from Guix where the build-side code is written in Scheme,
not Bash, and where there’s no direct way to define environment
variables.

Long story short: ‘guix import’ gives you the skeleton of a package
definition, but doesn’t convert the more difficult part.

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]