[bug#77899] gnu: Add valkey.

Message ID 1318262bde022227b21cc0b13bfa8e9561016d9c.1744984437.git.all_but_last@163.com
State New
Headers
Series [bug#77899] gnu: Add valkey. |

Commit Message

Zhu Zihao April 18, 2025, 2:12 p.m. UTC
  * gnu/packages/database.scm(valkey): New variable.

Change-Id: Ia1899ee41ecdd372d659c02940cc7ca9fbc011d8
---
 gnu/packages/databases.scm | 74 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 73 insertions(+), 1 deletion(-)


base-commit: 54cc9c96ec0877b2afa24871c3acd8af27b0d500
  

Patch

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 32973d3896..16593af4f7 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -54,7 +54,7 @@ 
 ;;; Copyright © 2021 Alexandre Hannud Abdo <abdo@member.fsf.org>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
-;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
+;;; Copyright © 2022, 2025 Zhu Zihao <all_but_last@163.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2022 muradm <mail@muradm.net>
 ;;; Copyright © 2022 Thomas Albers Raviola <thomas@thomaslabs.org>
@@ -2881,6 +2881,78 @@  (define-public redis
     (properties `((lint-hidden-cve . ("CVE-2022-3647" "CVE-2022-33105"))))
     (license license:bsd-3)))
 
+(define-public valkey
+  (package
+    (name "valkey")
+    (version "8.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/valkey-io/valkey")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0bd4jhh2hp75996mz62p6l31c0zkr3i9cw3v6va6j94srn9y8v1m"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Delete bundled jemalloc, as the package will use the libc one
+        #~(begin (delete-file-recursively "deps/jemalloc")))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:modules '((ice-9 ftw)
+                  (guix build utils)
+                  (guix build gnu-build-system))
+      #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
+                           "MALLOC=libc"
+                           (string-append "PREFIX=" #$output))
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (add-after 'unpack 'patch-paths
+            (lambda _
+              (substitute* "runtest"
+                (("^TCLSH=.*")
+                 (string-append "TCLSH=" (which "tclsh"))))
+              (substitute* "tests/support/server.tcl"
+                (("/usr/bin/env")
+                 (which "env")))))
+          (add-after 'unpack 'adjust-tests
+            (lambda _
+              ;; Disable failing tests.
+              ;; Valkey search test directories for tests.
+              (with-directory-excursion "tests"
+                ;; The AOF tests cause the test suite to hang waiting for a
+                ;; "background AOF rewrite to finish", perhaps because dead
+                ;; processes persist as zombies in the build environment.
+                (delete-file "unit/aofrw.tcl")
+                (delete-file "integration/aof-multi-part.tcl")
+
+                ;; The OOM score tests try to raise the current OOM score, but
+                ;; our build environment already sets it for all children to
+                ;; the highest possible one (1000).  We can't lower it because
+                ;; we don't have CAP_SYS_RESOURCE.
+                (delete-file "unit/oom-score-adj.tcl")
+
+                (delete-file "integration/failover.tcl")
+
+                (with-directory-excursion "integration"
+                  (for-each
+                   delete-file
+                   (scandir "." (lambda (filename)
+                                  (string-prefix? "replication" filename))))
+                  (delete-file "dual-channel-replication.tcl")
+                  (delete-file "cross-version-replication.tcl"))))))))
+    (native-inputs (list pkg-config procps tcl which))
+    (home-page "https://valkey.io/")
+    (synopsis "Free high-performance key/value datastore")
+    (description
+     "Valkey is an free high-performance key/value datastore that supports a
+variety of workloads such as caching, message queues, and can act as a primary
+database.")
+    (license license:bsd-3)))
+
 (define-public hiredis
   (package
     (name "hiredis")