blob: 708359fd559fb3818e4f681ff818b8fa8d19d8a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2024 Michal Atlas <michal_atlas+git@posteo.net>
;;; Copyright © 2024, 2025 Guillaume Le Vaillant <glv@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages quantum)
#:use-module (gnu packages)
#:use-module (gnu packages lisp-check)
#:use-module (gnu packages lisp-xyz)
#:use-module (guix build-system asdf)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages))
(define-public cl-rpcq
(sbcl-package->cl-source-package sbcl-rpcq))
(define-public sbcl-cl-quil
(package
(name "sbcl-cl-quil")
(version "1.26.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/quil-lang/quilc")
(commit (string-append "v" version))))
(file-name (git-file-name "cl-quil" version))
(sha256
(base32 "1s99lk456sw9hhsx5cf3x9r97iw9s3ydqsd94zz3bjnq77wmkhz5"))))
(build-system asdf-build-system/sbcl)
(arguments
(list
;; Requires cyclic dependency with qvm
#:tests? #f))
(inputs
(list sbcl-abstract-classes
sbcl-alexa
sbcl-alexandria
sbcl-cl-algebraic-data-type
sbcl-cl-grnm
sbcl-cl-heap
sbcl-cl-permutation
sbcl-cl-yacc
sbcl-global-vars
sbcl-magicl
sbcl-optima
sbcl-parse-float
sbcl-queues
sbcl-salza2
sbcl-split-sequence
sbcl-trivial-garbage
sbcl-yason))
(synopsis "The optimizing Quil compiler")
(description
"Quil is the quantum instruction language, originally developed at
Rigetti Computing. In Quil quantum algorithms are expressed using Quil's
standard gates and instructions")
(home-page "https://github.com/quil-lang/quilc")
(license license:asl2.0)))
(define-public cl-quil
(sbcl-package->cl-source-package sbcl-cl-quil))
(define-public sbcl-qvm
(package
(name "sbcl-qvm")
(version "1.17.2")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/quil-lang/qvm")
(commit (string-append "v" version))))
(file-name (git-file-name "cl-qvm" version))
(sha256
(base32 "1cvmkqfcy7rv5jlim4kh4dvqhd3jk6mw1kwrphaqghjymrf72yp8"))))
(build-system asdf-build-system/sbcl)
(outputs '("out" "bin"))
(inputs
(list sbcl-abstract-classes
sbcl-alexandria
sbcl-cffi
sbcl-cl-quil
sbcl-global-vars
sbcl-ieee-floats
sbcl-lparallel
sbcl-magicl
sbcl-mt19937
sbcl-static-vectors
sbcl-trivial-features
sbcl-trivial-garbage
;; qvm-app
sbcl-cl-syslog
sbcl-command-line-arguments
sbcl-hunchentoot
sbcl-slime-swank
sbcl-trivial-benchmark))
(arguments
(list
#:asd-systems ''("qvm" "qvm-app")
#:tests? #f
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'remove-git-dependency
(lambda _
(substitute* "app/src/qvm-app-version.lisp"
(("\\(git-hash '#:qvm-app\\)")
"\"unknown\""))))
(add-after 'unpack 'fix-build
(lambda _
;; Don't use symbol that doesn't exists in swank 2.31.
(substitute* "app/src/entry-point.lisp"
(("\\(defvar swank:\\*use-dedicated-output-stream\\*\\)")
"")
(("\\(setf swank:\\*use-dedicated-output-stream\\* nil\\)")
""))))
(add-after 'create-asdf-configuration 'build-program
(lambda* (#:key outputs #:allow-other-keys)
(build-program (string-append (assoc-ref outputs "bin")
"/bin/qvm")
outputs
#:dependencies '("qvm-app")
#:entry-program '((qvm-app::asdf-entry-point))
#:compress? #t))))))
(synopsis "Quil simulator")
(description
"This is the official Quil-Lang Quantum Virtual Machine (QVM),
a flexible and efficient simulator for Quil.")
(home-page "https://github.com/quil-lang/qvm")
(license (list license:asl2.0
license:agpl3))))
(define-public cl-qvm
(sbcl-package->cl-source-package sbcl-qvm))
|