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