Skip to content

Building hyprls on Guix (and reference to doom emacs configuration) #102

@dcunited001

Description

@dcunited001

I didn't find typical lsp-mode instructions. I submitted that as an issue over on Nathan-Melaku/hyprlang-ts-mode#4.

I was also able to build this fairly quickly on Guix.

I don't really have time to commit upstream though.

You would build this with:

tmp=$(mktemp -d)
cd $tmp
mkdir ./mypackages

# add content below to "$tmp/mypackages/tree-sitter.scm"

guix build -L $tmp \
  -e '(@  (mypackages tree-sitter) ts-hyprlang)'

Then install the package into a profile or whatever. It's in the guix profile i'm using for my doom emacs config, though idk if i'd recommend that approach unless using Guix System. My emacs config uses Guix while on NixOS, so emacs needs hyprls to be linkable to its own tree-sitter

I think the Guix maintainers would need the tests passing for this to work. Just posting it here in case any other Guix users find this problem. If this were added to a Guix checkout, then only one (define-public ts-hyprlang (package ... )) is required.

The tree-sitter build system makes adding packages to ./gnu/packages/tree-sitter.scm pretty simple.

(define-module (mypackages tree-sitter)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages crates-graphics)
  #:use-module (gnu packages crates-io)
  #:use-module (gnu packages node)
  #:use-module (gnu packages tree-sitter)
  #:use-module (guix build-system cargo)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system tree-sitter)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module (guix hg-download)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (srfi srfi-1))

;; defining this package is necessary to get access to tree-sitter-grammar
;; which isn't exported from ./gnu/packages/tree-sitter.scm in Guix
(define tree-sitter-hyprlang
  ((@@ (gnu packages tree-sitter) tree-sitter-grammar)
   "hyprlang" "Hyprlang"
   "171p3hj36a1jqflg9xv138445j4m4m16na6bgpm1km3l67jhvl54"
   "3.1.0"
   #:repository-url
   "https://github.com/tree-sitter-grammars/tree-sitter-hyprlang"))

;; this package extends the base to remove 'check from the build phases
(define-public ts-hyprlang
  (let ((base tree-sitter-hyprlang))
    (package
      (inherit base)
      (name "ts-hyprlang")
      (arguments
       (substitute-keyword-arguments (package-arguments base)
         ;; (delete 'check) from phases doesn't work
         ((#:tests? _ #f) #f))))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions