guix_mirror_bot pushed a commit to branch ocaml-team
in repository guix.

commit 51ff82991aa8d958322d9267749d5969e2bd24ac
Author: Jason Conroy <[email protected]>
AuthorDate: Wed Feb 4 10:48:05 2026 -0500

    gnu: ocaml5: Add ocaml-opam-state.
    
    * gnu/packages/ocaml5.scm (ocaml-opam-state): New variable.
    
    Change-Id: I9c7cbd5b521a5015e71097eb1a6a1656caa4d7fa
    Signed-off-by: Julien Lepiller <[email protected]>
---
 gnu/packages/ocaml5.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/ocaml5.scm b/gnu/packages/ocaml5.scm
index be3530e911..6188340852 100644
--- a/gnu/packages/ocaml5.scm
+++ b/gnu/packages/ocaml5.scm
@@ -2575,6 +2575,35 @@ OPAM.")))
        #:tests? #f
        #:phases %standard-phases))))
 
+(define ocaml-opam-state
+  (package
+    (inherit ocaml-opam-core)
+    (name "ocaml5-opam-state")
+    (arguments
+     `(#:package "opam-state"
+       ;; tests are run with the opam package
+       #:tests? #f
+       #:phases (modify-phases %standard-phases
+                  (add-before 'build 'pre-build
+                    (lambda* (#:key inputs make-flags #:allow-other-keys)
+                      (let ((bwrap (search-input-file inputs "/bin/bwrap")))
+                        ;; Use bwrap from the store directly.
+                        (substitute* "src/state/shellscripts/bwrap.sh"
+                          (("-v bwrap")
+                           (string-append "-v " bwrap))
+                          (("exec bwrap")
+                           (string-append "exec " bwrap))
+                          ;; Mount /gnu and /run/current-system in the
+                          ;; isolated environment when building with opam.
+                          ;; This is necessary for packages to find external
+                          ;; dependencies, such as a C compiler, make, etc...
+                          (("^add_sys_mounts /usr")
+                           (string-append "add_sys_mounts "
+                                          (%store-directory)
+                                          " /run/current-system /usr")))))))))
+    (inputs (list bubblewrap ocaml-spdx-licenses))
+    (propagated-inputs (list ocaml-opam-repository))))
+
 ;;;
 ;;; Avoid adding new packages to the end of this file. To reduce the chances
 ;;; of a merge conflict, place them above by existing packages with similar

Reply via email to