Commit | Line | Data |
---|---|---|
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> |
d9c80098 | 5 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
f61682e7 AW |
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 | ||
22 | (define-module (gnu packages agda) | |
23 | #:use-module (gnu packages haskell) | |
24 | #:use-module (gnu packages haskell-check) | |
25 | #:use-module (gnu packages haskell-web) | |
1237653a | 26 | #:use-module (guix build-system emacs) |
f61682e7 AW |
27 | #:use-module (guix build-system haskell) |
28 | #:use-module (guix build-system trivial) | |
29 | #:use-module (guix download) | |
30 | #:use-module ((guix licenses) #:prefix license:) | |
31 | #:use-module (guix packages)) | |
32 | ||
33 | (define-public agda | |
34 | (package | |
35 | (name "agda") | |
d9c80098 | 36 | (version "2.5.4.2") |
f61682e7 AW |
37 | (source |
38 | (origin | |
39 | (method url-fetch) | |
40 | (uri (string-append | |
41 | "https://hackage.haskell.org/package/Agda/Agda-" | |
42 | version ".tar.gz")) | |
43 | (sha256 | |
44 | (base32 | |
d9c80098 | 45 | "07wvawpfjhx3gw2w53v27ncv1bl0kkx08wkm6wzxldbslkcasign")))) |
f61682e7 AW |
46 | (build-system haskell-build-system) |
47 | (inputs | |
d9c80098 | 48 | `(("ghc-alex" ,ghc-alex) |
f61682e7 AW |
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 | |
131 | inductive families, which are similar to Haskell's GADTs, but they can be | |
132 | indexed by values and not just types. It also has parameterised modules, | |
133 | mixfix operators, Unicode characters, and an interactive Emacs interface (the | |
134 | type checker can assist in the development of your code). Agda is also a | |
135 | proof assistant: it is an interactive system for writing and checking proofs. | |
136 | Agda is based on intuitionistic type theory, a foundational system for | |
137 | constructive mathematics developed by the Swedish logician Per Martin-Löf. It | |
138 | has many similarities with other proof assistants based on dependent types, | |
139 | such 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 | |
158 | Agda. It also aids the input of Unicode characters."))) |