agda.scm 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. ;;; Copyright © 2018 John Soo <jsoo1@asu.edu>
  7. ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
  8. ;;;
  9. ;;; This file is part of GNU Guix.
  10. ;;;
  11. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; GNU Guix is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  23. (define-module (gnu packages agda)
  24. #:use-module (gnu packages haskell-check)
  25. #:use-module (gnu packages haskell-web)
  26. #:use-module (gnu packages haskell-xyz)
  27. #:use-module (guix build-system emacs)
  28. #:use-module (guix build-system gnu)
  29. #:use-module (guix build-system haskell)
  30. #:use-module (guix build-system trivial)
  31. #:use-module (guix download)
  32. #:use-module (guix git-download)
  33. #:use-module ((guix licenses) #:prefix license:)
  34. #:use-module (guix packages))
  35. (define-public agda
  36. (package
  37. (name "agda")
  38. (version "2.6.0.1")
  39. (source
  40. (origin
  41. (method url-fetch)
  42. (uri (string-append
  43. "https://hackage.haskell.org/package/Agda/Agda-"
  44. version ".tar.gz"))
  45. (sha256
  46. (base32
  47. "1s600ry1qwizr3ynyj05rvlx7jdcw9a1viyc0ycjamm5sjf8mf3v"))))
  48. (build-system haskell-build-system)
  49. (inputs
  50. `(("ghc-aeson" ,ghc-aeson)
  51. ("ghc-alex" ,ghc-alex)
  52. ("ghc-async" ,ghc-async)
  53. ("ghc-blaze-html" ,ghc-blaze-html)
  54. ("ghc-boxes" ,ghc-boxes)
  55. ("ghc-data-hash" ,ghc-data-hash)
  56. ("ghc-edisoncore" ,ghc-edisoncore)
  57. ("ghc-edit-distance" ,ghc-edit-distance)
  58. ("ghc-equivalence" ,ghc-equivalence)
  59. ("ghc-exceptions" ,ghc-exceptions)
  60. ("ghc-filemanip" ,ghc-filemanip)
  61. ("ghc-geniplate-mirror" ,ghc-geniplate-mirror)
  62. ("ghc-gitrev" ,ghc-gitrev)
  63. ("ghc-happy" ,ghc-happy)
  64. ("ghc-hashable" ,ghc-hashable)
  65. ("ghc-hashtables" ,ghc-hashtables)
  66. ("ghc-ieee754" ,ghc-ieee754)
  67. ("ghc-murmur-hash" ,ghc-murmur-hash)
  68. ("ghc-uri-encode" ,ghc-uri-encode)
  69. ("ghc-regex-tdfa" ,ghc-regex-tdfa)
  70. ("ghc-strict" ,ghc-strict)
  71. ("ghc-unordered-containers" ,ghc-unordered-containers)
  72. ("ghc-zlib" ,ghc-zlib)))
  73. (arguments
  74. `(#:modules ((guix build haskell-build-system)
  75. (guix build utils)
  76. (srfi srfi-26)
  77. (ice-9 match))
  78. #:phases
  79. (modify-phases %standard-phases
  80. ;; This allows us to call the 'agda' binary before installing.
  81. (add-after 'unpack 'set-ld-library-path
  82. (lambda _
  83. (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/dist/build"))
  84. #t))
  85. ;; FIXME: This is a copy of the standard configure phase with a tiny
  86. ;; difference: this package needs the -package-db flag to be passed
  87. ;; to "runhaskell" in addition to the "configure" action, because
  88. ;; Setup.hs depends on filemanip. Without this option the Setup.hs
  89. ;; file cannot be evaluated. The haskell-build-system should be
  90. ;; changed to pass "-package-db" to "runhaskell" in any case.
  91. (replace 'configure
  92. (lambda* (#:key outputs inputs tests? (configure-flags '())
  93. #:allow-other-keys)
  94. (let* ((out (assoc-ref outputs "out"))
  95. (name-version (strip-store-file-name out))
  96. (ghc-path (getenv "GHC_PACKAGE_PATH"))
  97. (params
  98. `(,(string-append "--prefix=" out)
  99. ,(string-append "--libdir=" out "/lib")
  100. ,(string-append "--docdir=" out
  101. "/share/doc/" name-version)
  102. "--libsubdir=$compiler/$pkg-$version"
  103. "--package-db=../package.conf.d"
  104. "--global"
  105. ,@(if tests?
  106. '("--enable-tests")
  107. '())
  108. ;; Build and link with shared libraries
  109. "--enable-shared"
  110. "--enable-executable-dynamic"
  111. "--ghc-option=-fPIC"
  112. ,(string-append "--ghc-option=-optl=-Wl,-rpath=" out
  113. "/lib/$compiler/$pkg-$version")
  114. ,@configure-flags)))
  115. (unsetenv "GHC_PACKAGE_PATH")
  116. (apply invoke "runhaskell" "-package-db=../package.conf.d"
  117. "Setup.hs" "configure" params)
  118. (setenv "GHC_PACKAGE_PATH" ghc-path)
  119. #t)))
  120. (add-after 'compile 'agda-compile
  121. (lambda* (#:key outputs #:allow-other-keys)
  122. (let* ((out (assoc-ref outputs "out"))
  123. (agda-compiler (string-append out "/bin/agda")))
  124. (for-each (cut invoke agda-compiler <>)
  125. (find-files (string-append out "/share") "\\.agda$"))
  126. #t))))))
  127. (home-page "https://wiki.portal.chalmers.se/agda/")
  128. (synopsis
  129. "Dependently typed functional programming language and proof assistant")
  130. (description
  131. "Agda is a dependently typed functional programming language: it has
  132. inductive families, which are similar to Haskell's GADTs, but they can be
  133. indexed by values and not just types. It also has parameterised modules,
  134. mixfix operators, Unicode characters, and an interactive Emacs interface (the
  135. type checker can assist in the development of your code). Agda is also a
  136. proof assistant: it is an interactive system for writing and checking proofs.
  137. Agda is based on intuitionistic type theory, a foundational system for
  138. constructive mathematics developed by the Swedish logician Per Martin-Löf. It
  139. has many similarities with other proof assistants based on dependent types,
  140. such as Coq, Epigram and NuPRL.")
  141. ;; Agda is distributed under the MIT license, and a couple of
  142. ;; source files are BSD-3. See LICENSE for details.
  143. (license (list license:expat license:bsd-3))))
  144. (define-public emacs-agda2-mode
  145. (package
  146. (inherit agda)
  147. (name "emacs-agda2-mode")
  148. (build-system emacs-build-system)
  149. (inputs '())
  150. (arguments
  151. `(#:phases
  152. (modify-phases %standard-phases
  153. (add-after 'unpack 'enter-elisp-dir
  154. (lambda _ (chdir "src/data/emacs-mode") #t)))))
  155. (home-page "https://agda.readthedocs.io/en/latest/tools/emacs-mode.html")
  156. (synopsis "Emacs mode for Agda")
  157. (description "This Emacs mode enables interactive development with
  158. Agda. It also aids the input of Unicode characters.")))
  159. (define-public agda-ial
  160. (package
  161. (name "agda-ial")
  162. (version "1.5.0")
  163. (home-page "https://github.com/cedille/ial")
  164. (source (origin
  165. (method git-fetch)
  166. (uri (git-reference (url home-page)
  167. (commit (string-append "v" version))))
  168. (file-name (git-file-name name version))
  169. (sha256
  170. (base32
  171. "0dlis6v6nzbscf713cmwlx8h9n2gxghci8y21qak3hp18gkxdp0g"))))
  172. (build-system gnu-build-system)
  173. (inputs
  174. `(("agda" ,agda)))
  175. (arguments
  176. `(#:parallel-build? #f
  177. #:phases
  178. (modify-phases %standard-phases
  179. (delete 'configure)
  180. (add-before 'build 'patch-dependencies
  181. (lambda _ (patch-shebang "find-deps.sh") #t))
  182. (delete 'check)
  183. (replace 'install
  184. (lambda* (#:key outputs #:allow-other-keys)
  185. (let* ((out (assoc-ref outputs "out"))
  186. (include (string-append out "/include/agda/ial")))
  187. (for-each (lambda (file)
  188. (make-file-writable file)
  189. (install-file file include))
  190. (find-files "." "\\.agdai?(-lib)?$"))
  191. #t))))))
  192. (synopsis "The Iowa Agda Library")
  193. (description
  194. "The goal is to provide a concrete library focused on verification
  195. examples, as opposed to mathematics. The library has a good number
  196. of theorems for booleans, natural numbers, and lists. It also has
  197. trees, tries, vectors, and rudimentary IO. A number of good ideas
  198. come from Agda's standard library.")
  199. (license license:expat)))