Subject: [PATCH v2 12/12] gnu: Add cl-qvm

From: Michal Atlas <[email-masked]>
Date: Fri, 24 Nov 2023 17:07:17 +0000

* gnu/packages/quantum.scm: (sbcl-qvm, cl-qvm): New variables.

Change-Id: Ife0bdcfdce01dc6ca4a7115cb54e093a76729527
---
 gnu/packages/quantum.scm | 64 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/gnu/packages/quantum.scm b/gnu/packages/quantum.scm
index 01f1d0e8f9..1cd980cb3f 100644
--- a/gnu/packages/quantum.scm
+++ b/gnu/packages/quantum.scm
@@ -142,3 +142,67 @@ (define-public sbcl-cl-quil
 (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 name version))
+       (sha256
+        (base32 "1cvmkqfcy7rv5jlim4kh4dvqhd3jk6mw1kwrphaqghjymrf72yp8"))))
+    (build-system asdf-build-system/sbcl)
+    (outputs '("out" "bin"))
+    (inputs (list sbcl-alexandria
+                  sbcl-abstract-classes
+                  sbcl-ieee-floats
+                  sbcl-lparallel
+                  sbcl-magicl
+                  sbcl-trivial-garbage
+                  sbcl-global-vars
+                  sbcl-cffi
+                  sbcl-static-vectors
+                  sbcl-trivial-garbage
+                  sbcl-cl-quil
+                  sbcl-mt19937
+                  sbcl-trivial-features
+
+                  ;; qvm-app
+                  sbcl-command-line-arguments
+                  sbcl-trivial-benchmark
+                  sbcl-hunchentoot
+                  sbcl-slime-swank
+                  sbcl-cl-syslog))
+    (arguments
+     (list
+      #:asd-systems ''("qvm" "qvm-app")
+      ;; Requires cyclic dependency with quilc
+      #: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 '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 "The high-performance and featureful 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 license:asl2.0)))
+
+(define-public cl-qvm
+  (sbcl-package->cl-source-package sbcl-qvm))
-- 
2.41.0