summary refs log tree commit diff
path: root/gnu/packages/ruby.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-01-08 02:07:40 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-28 22:22:24 -0400
commit7405e0c83f8f4eee5c4c40e809a40f2e4407a38c (patch)
tree9101e9041ef60d479955dfc663a37359b6859e6d /gnu/packages/ruby.scm
parent193a459d288f4a939b4b6173c7a773bc6966cfef (diff)
downloadguix-7405e0c83f8f4eee5c4c40e809a40f2e4407a38c.tar.gz
gnu: Add ruby-sorbet-runtime.
* gnu/packages/ruby.scm (ruby-sorbet-runtime): New variable.
(sorbet-version): New variable.
(sorbet-monorepo): New variable.
(make-sorbet-gem-source): New procedure.
Diffstat (limited to 'gnu/packages/ruby.scm')
-rw-r--r--gnu/packages/ruby.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index c3edbfa988..ead64b98ea 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -89,6 +89,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix gexp)
+  #:use-module (guix modules)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages xml)
@@ -12337,6 +12338,56 @@ can be used to build formatters, linters, language servers, and more.")
     (home-page "https://github.com/ruby-syntax-tree/syntax_tree")
     (license license:expat)))
 
+(define sorbet-version "0.5.10610.20230106174520-1fa668010")
+
+(define sorbet-monorepo
+  (origin
+    (method git-fetch)
+    (uri (git-reference
+          (url "https://github.com/sorbet/sorbet")
+          (commit sorbet-version)))
+    (file-name (string-append "sorbet-" sorbet-version "-checkout"))
+    (sha256
+     (base32
+      "0f21dl06alxwn6xgdxyrkd58plmmsv04z2bcls9ld4cfzsrs5537"))))
+
+(define (make-sorbet-gem-source gem)
+  "Return the source of GEM, a sub-directory."
+  (computed-file
+   (string-append "ruby-sorbet-" gem "-" sorbet-version "-checkout")
+   (with-imported-modules (source-module-closure '((guix build utils)))
+     #~(begin
+         (use-modules (guix build utils))
+         (copy-recursively (string-append #$sorbet-monorepo
+                                          "/gems/sorbet-" #$gem)
+                           #$output)))))
+
+(define-public ruby-sorbet-runtime
+  (package
+    (name "ruby-sorbet-runtime")
+    (version sorbet-version)
+    (source (make-sorbet-gem-source "runtime"))
+    (build-system ruby-build-system)
+    ;; 25 out of 841 tests currently fail, seemingly due to invalid
+    ;; assumptions about file names in the build environment (see:
+    ;; https://github.com/sorbet/sorbet/issues/6650).
+    (arguments (list #:tests? #f))
+    (native-inputs
+     (list ruby-minitest
+           ruby-mocha
+           ruby-rubocop
+           ruby-rubocop-performance
+           ruby-concurrent-ruby
+           ruby-pry
+           ruby-pry-byebug
+           ruby-parser
+           ruby-subprocess))
+    (synopsis "Runtime type checking component for Sorbet")
+    (description "Sorbet's runtime type checking component.  Sorbet is a
+powerful type checker for Ruby.")
+    (home-page "https://sorbet.org")
+    (license license:asl2.0)))
+
 (define-public ruby-mustache
   (package
     (name "ruby-mustache")