gnu: emacs: Find packages in "~/.guix-profile".

* gnu/packages/emacs.scm (emacs)[inputs]: Add 'guix-src' input.
  [arguments]: Add 'install-site-start' phase.

Co-authored-by: Alex Kost <alezost@gmail.com>
This commit is contained in:
Federico Beffa 2016-01-01 15:12:40 +01:00 committed by Alex Kost
parent 2c776157ad
commit 13fe4891fa
1 changed files with 38 additions and 15 deletions

View File

@ -52,6 +52,7 @@
#:use-module (gnu packages xml) #:use-module (gnu packages xml)
#:use-module (gnu packages glib) #:use-module (gnu packages glib)
#:use-module (gnu packages acl) #:use-module (gnu packages acl)
#:use-module (gnu packages package-management)
#:use-module (gnu packages perl) #:use-module (gnu packages perl)
#:use-module (gnu packages pdf) #:use-module (gnu packages pdf)
#:use-module (gnu packages xiph) #:use-module (gnu packages xiph)
@ -74,7 +75,8 @@
(search-patch "emacs-source-date-epoch.patch"))))) (search-patch "emacs-source-date-epoch.patch")))))
(build-system glib-or-gtk-build-system) (build-system glib-or-gtk-build-system)
(arguments (arguments
'(#:phases (modify-phases %standard-phases `(#:phases
(modify-phases %standard-phases
(add-before 'configure 'fix-/bin/pwd (add-before 'configure 'fix-/bin/pwd
(lambda _ (lambda _
;; Use `pwd', not `/bin/pwd'. ;; Use `pwd', not `/bin/pwd'.
@ -87,6 +89,26 @@
(let ((out (assoc-ref outputs "out"))) (let ((out (assoc-ref outputs "out")))
(delete-file (delete-file
(string-append out "/share/info/info.info.gz")) (string-append out "/share/info/info.info.gz"))
#t)))
(add-after 'install 'install-site-start
;; Copy guix-emacs.el from Guix and add it to site-start.el. This
;; way, Emacs packages provided by Guix and installed in
;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
;; automatically found.
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((guix-src (assoc-ref inputs "guix-src"))
(out (assoc-ref outputs "out"))
(lisp-dir (string-append out "/share/emacs/"
,(version-major+minor version)
"/site-lisp"))
(unpack (assoc-ref %standard-phases 'unpack)))
(mkdir "guix")
(with-directory-excursion "guix"
(apply unpack (list #:source guix-src))
(install-file "emacs/guix-emacs.el" lisp-dir))
(with-output-to-file (string-append lisp-dir "/site-start.el")
(lambda ()
(display "(require 'guix-emacs nil t)")))
#t)))))) #t))))))
(inputs (inputs
`(("gnutls" ,gnutls) `(("gnutls" ,gnutls)
@ -112,7 +134,8 @@
("libice" ,libice) ("libice" ,libice)
("libsm" ,libsm) ("libsm" ,libsm)
("alsa-lib" ,alsa-lib) ("alsa-lib" ,alsa-lib)
("dbus" ,dbus))) ("dbus" ,dbus)
("guix-src" ,(package-source guix))))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config) `(("pkg-config" ,pkg-config)
("texinfo" ,texinfo))) ("texinfo" ,texinfo)))