Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911865 - app-editors/helix-23.05: hx looks at the wrong path for runtime dir
Summary: app-editors/helix-23.05: hx looks at the wrong path for runtime dir
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Patrick McLean
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-08-07 14:26 UTC by sin-ack
Modified: 2023-10-26 17:19 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sin-ack 2023-08-07 14:26:05 UTC
Helix seems to be hardcoded to look at the directory it's installed at for the system-level runtime directory. As such, when Helix is installed at /usr/bin/hx, things like helix --tutor don't work because the runtime directory is assumed to reside at /usr/bin/runtime.

Apparently there is no way to set this at build time, however the HELIX_RUNTIME environment variable can be set during startup to point at the right directory.

The official Nix flake they provide creates a wrapper script which sets the runtime directory:

https://github.com/helix-editor/helix/blob/1d189820a150eb38c55d419ad6dd350321d4c8ee/flake.nix#L105

Gentoo probably needs to do the same.

Reproducible: Always

Steps to Reproduce:
1. sudo emerge app-editors/helix
2. Run hx --tutor
Actual Results:  
Tutor file can't be found so the blank buffer is shown.

Expected Results:  
hx --tutor should start the Helix tutor.
Comment 1 Jonas Frei 2023-08-08 15:35:18 UTC
Can you check if the file /etc/env.d/99helix exists on your system? It should be installed with the helix package and globally set the HELIX_RUNTIME env var.
Comment 2 sin-ack 2023-08-08 15:49:19 UTC
Yes, it is present:

callisto ~ ยป cat /etc/env.d/99helix 
HELIX_RUNTIME="/usr/share/helix/runtime"

However, it doesn't seem to be picked up. Could this be a problem with my system instead?
Comment 3 Jonas Frei 2023-08-09 06:10:58 UTC
Maybe you installed the package and with the running shell sessions immediately tried to launch helix without sourcing the new env var?

You could try `env-update && source /etc/profile` after a fresh install.
Comment 4 glyphimor 2023-09-16 19:45:21 UTC
Ran into this problem as well: installed helix for the first time, loaded a python file, and realized there was no syntax highlighting. 30 minutes later, after googling, trying to install tree-sitter packages, etc., I figured out what was going on... not an ideal experience.

[Helix docs](https://docs.helix-editor.com/master/install.html?#configuring-helixs-runtime-files) say:

>When Helix finds multiple runtime directories it will search through them for files in the following order:
>
>    1. runtime/ sibling directory to $CARGO_MANIFEST_DIR directory (this is intended for developing and testing helix only).
>    2. runtime/ subdirectory of OS-dependent helix user config directory.
>    3. $HELIX_RUNTIME.
>    4. runtime/ subdirectory of path to Helix executable.

Immediately after install, running hx --health reported:
    
>    Runtime directories: /home/e/.config/helix/runtime;/usr/bin/runtime
>    Runtime directory does not exist: /home/e/.config/helix/runtime
>    Runtime directory does not exist: /usr/bin/runtime

I double-checked that $HELIX_RUNTIME wasn't set -- didn't know I had to run env-update, etc. Actually ended up fixing it by linking /usr/share/helix/runtime in ~/.config/helix. Later, after a reboot, realized the environment variable was now being set.

Summarizing, it would be helpful to add a message to the helix ebuild. A potential long-winded message:

"Helix relies on files in its runtime directory for some functionality (e.g. syntax highlighting). On gentoo, the runtime directory is /usr/share/helix/runtime, but that path needs to be supplied to helix. That can be done either by setting the HELIX_RUNTIME environment variable, or linking the path to ~/.config/helix/runtime. HELIX_RUNTIME has already been set: in any open shells, run env-update && source /etc/profile, then confirm helix picked up on the path by checking the output of hx --health"
Comment 5 Larry the Git Cow gentoo-dev 2023-10-26 17:19:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e4c03bfca1f453346e6eab80105ccb420738d2a

commit 6e4c03bfca1f453346e6eab80105ccb420738d2a
Author:     Jonas Frei <freijon@pm.me>
AuthorDate: 2023-10-25 18:48:26 +0000
Commit:     Patrick McLean <chutzpah@gentoo.org>
CommitDate: 2023-10-26 17:19:13 +0000

    app-editors/helix: add 23.10
    
    Closes: https://bugs.gentoo.org/911865
    Signed-off-by: Jonas Frei <freijon@pm.me>
    Closes: https://github.com/gentoo/gentoo/pull/33512
    Signed-off-by: Patrick McLean <chutzpah@gentoo.org>

 app-editors/helix/Manifest           | 122 +++++++++++++
 app-editors/helix/helix-23.10.ebuild | 334 +++++++++++++++++++++++++++++++++++
 2 files changed, 456 insertions(+)