agda.scm 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Alex ter Weele <alex.ter.weele@gmail.com>
  3. ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
  4. ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
  5. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages agda)
  22. #:use-module (gnu packages haskell)
  23. #:use-module (gnu packages haskell-check)
  24. #:use-module (gnu packages haskell-web)
  25. #:use-module (guix build-system emacs)
  26. #:use-module (guix build-system haskell)
  27. #:use-module (guix build-system trivial)
  28. #:use-module (guix download)
  29. #:use-module ((guix licenses) #:prefix license:)
  30. #:use-module (guix packages))
  31. (define-public agda
  32. (package
  33. (name "agda")
  34. (version "2.5.4.2")
  35. (source
  36. (origin
  37. (method url-fetch)
  38. (uri (string-append
  39. "https://hackage.haskell.org/package/Agda/Agda-"
  40. version ".tar.gz"))
  41. (sha256
  42. (base32
  43. "07wvawpfjhx3gw2w53v27ncv1bl0kkx08wkm6wzxldbslkcasign"))))
  44. (build-system haskell-build-system)
  45. (inputs
  46. `(("ghc-alex" ,ghc-alex)
  47. ("ghc-async" ,ghc-async)
  48. ("ghc-blaze-html" ,ghc-blaze-html)
  49. ("ghc-boxes" ,ghc-boxes)
  50. ("ghc-data-hash" ,ghc-data-hash)
  51. ("ghc-edisoncore" ,ghc-edisoncore)
  52. ("ghc-edit-distance" ,ghc-edit-distance)
  53. ("ghc-equivalence" ,ghc-equivalence)
  54. ("ghc-filemanip" ,ghc-filemanip)
  55. ("ghc-geniplate-mirror" ,ghc-geniplate-mirror)
  56. ("ghc-gitrev" ,ghc-gitrev)
  57. ("ghc-happy" ,ghc-happy)
  58. ("ghc-hashable" ,ghc-hashable)
  59. ("ghc-hashtables" ,ghc-hashtables)
  60. ("ghc-ieee754" ,ghc-ieee754)
  61. ("ghc-murmur-hash" ,ghc-murmur-hash)
  62. ("ghc-uri-encode" ,ghc-uri-encode)
  63. ("ghc-parallel" ,ghc-parallel)
  64. ("ghc-regex-tdfa" ,ghc-regex-tdfa)
  65. ("ghc-stm" ,ghc-stm)
  66. ("ghc-strict" ,ghc-strict)
  67. ("ghc-text" ,ghc-text)
  68. ("ghc-unordered-containers" ,ghc-unordered-containers)
  69. ("ghc-zlib" ,ghc-zlib)))
  70. (arguments
  71. `(#:modules ((guix build haskell-build-system)
  72. (guix build utils)
  73. (srfi srfi-26)
  74. (ice-9 match))
  75. #:phases
  76. (modify-phases %standard-phases
  77. ;; FIXME: This is a copy of the standard configure phase with a tiny
  78. ;; difference: this package needs the -package-db flag to be passed
  79. ;; to "runhaskell" in addition to the "configure" action, because
  80. ;; Setup.hs depends on filemanip. Without this option the Setup.hs
  81. ;; file cannot be evaluated. The haskell-build-system should be
  82. ;; changed to pass "-package-db" to "runhaskell" in any case.
  83. (replace 'configure
  84. (lambda* (#:key outputs inputs tests? (configure-flags '())
  85. #:allow-other-keys)
  86. (let* ((out (assoc-ref outputs "out"))
  87. (name-version (strip-store-file-name out))
  88. (input-dirs (match inputs
  89. (((_ . dir) ...)
  90. dir)
  91. (_ '())))
  92. (ghc-path (getenv "GHC_PACKAGE_PATH"))
  93. (params (append `(,(string-append "--prefix=" out))
  94. `(,(string-append "--libdir=" out "/lib"))
  95. `(,(string-append "--bindir=" out "/bin"))
  96. `(,(string-append
  97. "--docdir=" out
  98. "/share/doc/" name-version))
  99. '("--libsubdir=$compiler/$pkg-$version")
  100. '("--package-db=../package.conf.d")
  101. '("--global")
  102. `(,@(map
  103. (cut string-append "--extra-include-dirs=" <>)
  104. (search-path-as-list '("include") input-dirs)))
  105. `(,@(map
  106. (cut string-append "--extra-lib-dirs=" <>)
  107. (search-path-as-list '("lib") input-dirs)))
  108. (if tests?
  109. '("--enable-tests")
  110. '())
  111. configure-flags)))
  112. (unsetenv "GHC_PACKAGE_PATH")
  113. (apply invoke "runhaskell" "-package-db=../package.conf.d"
  114. "Setup.hs" "configure" params)
  115. (setenv "GHC_PACKAGE_PATH" ghc-path)
  116. #t)))
  117. (add-after 'compile 'agda-compile
  118. (lambda* (#:key outputs #:allow-other-keys)
  119. (let* ((out (assoc-ref outputs "out"))
  120. (agda-compiler (string-append out "/bin/agda")))
  121. (for-each (cut invoke agda-compiler <>)
  122. (find-files (string-append out "/share") "\\.agda$"))
  123. #t))))))
  124. (home-page "http://wiki.portal.chalmers.se/agda/")
  125. (synopsis
  126. "Dependently typed functional programming language and proof assistant")
  127. (description
  128. "Agda is a dependently typed functional programming language: it has
  129. inductive families, which are similar to Haskell's GADTs, but they can be
  130. indexed by values and not just types. It also has parameterised modules,
  131. mixfix operators, Unicode characters, and an interactive Emacs interface (the
  132. type checker can assist in the development of your code). Agda is also a
  133. proof assistant: it is an interactive system for writing and checking proofs.
  134. Agda is based on intuitionistic type theory, a foundational system for
  135. constructive mathematics developed by the Swedish logician Per Martin-Löf. It
  136. has many similarities with other proof assistants based on dependent types,
  137. such as Coq, Epigram and NuPRL.")
  138. ;; Agda is distributed under the MIT license, and a couple of
  139. ;; source files are BSD-3. See LICENSE for details.
  140. (license (list license:expat license:bsd-3))))
  141. (define-public emacs-agda2-mode
  142. (package
  143. (inherit agda)
  144. (name "emacs-agda2-mode")
  145. (build-system emacs-build-system)
  146. (inputs '())
  147. (arguments
  148. `(#:phases
  149. (modify-phases %standard-phases
  150. (add-after 'unpack 'enter-elisp-dir
  151. (lambda _ (chdir "src/data/emacs-mode") #t)))))
  152. (home-page "https://agda.readthedocs.io/en/latest/tools/emacs-mode.html")
  153. (synopsis "Emacs mode for Agda")
  154. (description "This Emacs mode enables interactive development with
  155. Agda. It also aids the input of Unicode characters.")))