Subject: [PATCH rust-team 01/30] gnu: Add helix.

From: Murilo <[email-masked]>
Date: Sun, 24 Nov 2024 23:48:12 -0300

* gnu/packages/rust-apps.scm (helix): New variable.

Change-Id: Ib2d83d3985f09e19601b126749b9a7faa4926bb9
---
 gnu/packages/rust-apps.scm | 108 +++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 652793755b..546a8f71a1 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -32,6 +32,7 @@
 ;;; Copyright © 2024 Tomas Volf <[email-masked]>
 ;;; Copyright © 2024 Suhail Singh <[email-masked]>
 ;;; Copyright © 2024 Jordan Moore <[email-masked]>
+;;; Copyright © 2024 Murilo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -999,6 +1000,113 @@ (define-public gitui
     (description "This package provides a fast Terminal UI for git.")
     (license license:expat)))
 
+(define-public helix
+  (package
+    (name "helix")
+    (version "24.07")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/helix-editor/helix")
+             (commit version)))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (delete-file-recursively "Cargo.lock")))
+       (file-name (git-file-name "helix" version))
+       (sha256
+        (base32 "1f0l65z1cy8m9x79p5y5kwk1psv0ppfz9lwylggm71q0lj127awl"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:install-source? #f
+       #:phases ,#~(modify-phases %standard-phases
+                     (add-after 'unpack 'disable-grammar-build
+                       (lambda _
+                         (setenv "HELIX_DISABLE_AUTO_GRAMMAR_BUILD" "1")))
+                     (replace 'install
+                       (lambda _
+                         (let* ((bin (string-append #$output "/bin"))
+                                (hx (string-append bin "/hx"))
+                                (share (string-append #$output
+                                                      "/usr/share/helix"))
+                                (runtime (string-append share "/runtime"))
+                                (applications (string-append #$output
+                                               "/share/applications")))
+                           (install-file "target/release/hx" bin)
+                           (install-file "contrib/Helix.desktop" applications)
+                           (copy-recursively "runtime" runtime)
+                           (wrap-program hx
+                             `("HELIX_RUNTIME" prefix
+                               (,runtime)))))))
+       #:cargo-inputs (("rust-ahash" ,rust-ahash-0.8)
+                       ("rust-anyhow" ,rust-anyhow-1)
+                       ("rust-arc-swap" ,rust-arc-swap-1)
+                       ("rust-bitflags" ,rust-bitflags-2)
+                       ("rust-cassowary" ,rust-cassowary-0.3)
+                       ("rust-cc" ,rust-cc-1)
+                       ("rust-chardetng" ,rust-chardetng-0.1)
+                       ("rust-chrono" ,rust-chrono-0.4)
+                       ("rust-clipboard-win" ,rust-clipboard-win-5)
+                       ("rust-content-inspector" ,rust-content-inspector-0.2)
+                       ("rust-crossterm" ,rust-crossterm-0.27)
+                       ("rust-dunce" ,rust-dunce-1)
+                       ("rust-encoding-rs" ,rust-encoding-rs-0.8)
+                       ("rust-etcetera" ,rust-etcetera-0.8)
+                       ("rust-fern" ,rust-fern-0.6)
+                       ("rust-futures-executor" ,rust-futures-executor-0.3)
+                       ("rust-futures-util" ,rust-futures-util-0.3)
+                       ("rust-gix" ,rust-gix-0.63)
+                       ("rust-globset" ,rust-globset-0.4)
+                       ("rust-grep-regex" ,rust-grep-regex-0.1)
+                       ("rust-grep-searcher" ,rust-grep-searcher-0.1)
+                       ("rust-hashbrown" ,rust-hashbrown-0.14)
+                       ("rust-ignore" ,rust-ignore-0.4)
+                       ("rust-imara-diff" ,rust-imara-diff-0.1)
+                       ("rust-indoc" ,rust-indoc-2)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-libloading" ,rust-libloading-0.8)
+                       ("rust-log" ,rust-log-0.4)
+                       ("rust-lsp-types" ,rust-lsp-types-0.95)
+                       ("rust-nucleo" ,rust-nucleo-0.2)
+                       ("rust-once-cell" ,rust-once-cell-1)
+                       ("rust-open" ,rust-open-5)
+                       ("rust-parking-lot" ,rust-parking-lot-0.12)
+                       ("rust-pulldown-cmark" ,rust-pulldown-cmark-0.11)
+                       ("rust-quickcheck" ,rust-quickcheck-1)
+                       ("rust-regex" ,rust-regex-1)
+                       ("rust-regex-cursor" ,rust-regex-cursor-0.1)
+                       ("rust-ropey" ,rust-ropey-1)
+                       ("rust-rustix" ,rust-rustix-0.38)
+                       ("rust-serde" ,rust-serde-1)
+                       ("rust-serde-json" ,rust-serde-json-1)
+                       ("rust-signal-hook" ,rust-signal-hook-0.3)
+                       ("rust-signal-hook-tokio" ,rust-signal-hook-tokio-0.3)
+                       ("rust-slotmap" ,rust-slotmap-1)
+                       ("rust-smallvec" ,rust-smallvec-1)
+                       ("rust-smartstring" ,rust-smartstring-1)
+                       ("rust-tempfile" ,rust-tempfile-3)
+                       ("rust-termini" ,rust-termini-1)
+                       ("rust-textwrap" ,rust-textwrap-0.16)
+                       ("rust-thiserror" ,rust-thiserror-1)
+                       ("rust-threadpool" ,rust-threadpool-1)
+                       ("rust-tokio" ,rust-tokio-1)
+                       ("rust-tokio-stream" ,rust-tokio-stream-0.1)
+                       ("rust-toml" ,rust-toml-0.8)
+                       ("rust-tree-sitter" ,rust-tree-sitter-0.22)
+                       ("rust-unicode-general-category"
+                        ,rust-unicode-general-category-0.6)
+                       ("rust-unicode-segmentation" ,rust-unicode-segmentation-1)
+                       ("rust-unicode-width" ,rust-unicode-width-0.1)
+                       ("rust-url" ,rust-url-2)
+                       ("rust-which" ,rust-which-6)
+                       ("rust-windows-sys" ,rust-windows-sys-0.52))))
+    (inputs (list bash-minimal))
+    (native-inputs (list git))
+    (home-page "https://helix-editor.com/")
+    (synopsis "Post-modern modal text editor")
+    (description "A Kakoune / Neovim inspired editor, written in Rust.")
+    (license (list license:mpl2.0))))
+
 (define-public helvum
   (package
     (name "helvum")
-- 
2.46.0