guix.scm 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ;;; guix.scm --- Guix package for Emacs-Guix
  2. ;; Copyright © 2017 Alex Kost <alezost@gmail.com>
  3. ;; This file is part of Emacs-Guix.
  4. ;; Emacs-Guix is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;;
  9. ;; Emacs-Guix is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;;
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with Emacs-Guix. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;; This file contains Guix package for development version of
  18. ;; Emacs-Guix. To build or install, run:
  19. ;;
  20. ;; guix build --file=guix.scm
  21. ;; guix package --install-from-file=guix.scm
  22. ;; The main purpose of this file though is to make a development
  23. ;; environment for building Emacs-Guix:
  24. ;;
  25. ;; guix environment --pure --load=guix.scm
  26. ;; ./autogen.sh
  27. ;; ./configure
  28. ;; make
  29. ;;; Code:
  30. (use-modules
  31. (ice-9 popen)
  32. (ice-9 rdelim)
  33. (guix build utils)
  34. (guix gexp)
  35. (guix git-download)
  36. (guix packages)
  37. (gnu packages autotools)
  38. (gnu packages emacs)
  39. (gnu packages pkg-config)
  40. (gnu packages texinfo))
  41. (define %source-dir (dirname (current-filename)))
  42. (define (git-output . args)
  43. "Execute 'git ARGS ...' command and return its output without trailing
  44. newspace."
  45. (with-directory-excursion %source-dir
  46. (let* ((port (apply open-pipe* OPEN_READ "git" args))
  47. (output (read-string port)))
  48. (close-port port)
  49. (string-trim-right output #\newline))))
  50. (define (current-commit)
  51. (git-output "log" "-n" "1" "--pretty=format:%H"))
  52. (define emacs-guix-devel
  53. (let ((commit (current-commit)))
  54. (package
  55. (inherit emacs-guix)
  56. (version (string-append (package-version emacs-guix)
  57. "-" (string-take commit 7)))
  58. (source (local-file %source-dir
  59. #:recursive? #t
  60. #:select? (git-predicate %source-dir)))
  61. (arguments
  62. (append (package-arguments emacs-guix)
  63. '(#:phases
  64. (modify-phases %standard-phases
  65. (add-after 'unpack 'autogen
  66. (lambda _ (zero? (system* "sh" "autogen.sh"))))))))
  67. (native-inputs
  68. `(("pkg-config" ,pkg-config)
  69. ;; 'emacs-minimal' does not find Emacs packages (this is for
  70. ;; "guix environment").
  71. ("emacs" ,emacs-no-x)
  72. ("autoconf" ,autoconf)
  73. ("automake" ,automake)
  74. ("texinfo" ,texinfo))))))
  75. emacs-guix-devel
  76. ;;; guix.scm ends here