guix.scm 2.8 KB

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