NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.62k stars 13.77k forks source link

Helix additional language config fails because it cannot write to nix store #217860

Open aldafu opened 1 year ago

aldafu commented 1 year ago

Describe the bug

Helix allows to have a local configuration that adds support for other languages that are then highlighted based on that custom language configuration, see here for details: https://docs.helix-editor.com/languages.html

Once configured it is needed to "fetch" and "build" this configuration by running helix. Helix will then try to create a directory and generate some files, but that fails since it is not allowed to write to root owned /nix/store.

The error message is:

» hx --grammar fetch
Fetching 1 grammars
1 grammars failed to fetch
    Failure 1/1: Could not create grammar directory "/nix/store/py9sm09af0bj67jlrnlz2jwcsgkl5qag-helix-22.12/lib/runtime/grammars/sources/<actual-languagename-here>"

Steps To Reproduce

Steps to reproduce the behavior:

  1. Write/have tree-sitter grammar for additional language
  2. hx --grammar fetch

Expected behavior

Helix should work for custom languages that are added in the local configuration and be able to "fetch" and "build" these.

Additional context

Happy to provide if needed.

Notify maintainers

@danth @yusdacra @mweinelt

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-darwin"`
 - host os: `Darwin 22.3.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.13.2`
 - channels(<user-redacted>): `"nixpkgs, nixpkgs-22.11-darwin-22.11-darwin"`
 - channels(root): `""`
 - nixpkgs: `/Users/<user-redacted>/.nix-defexpr/channels/nixpkgs`
gruhn commented 1 year ago

same here

Edit:

Actually, since nix store is immuable, this is probably working as intended. The Helix people have issues for that:

https://github.com/helix-editor/helix/issues/3310 https://github.com/helix-editor/helix/issues/3346

n8henrie commented 6 months ago

hx --grammar fetch is working for me on x86_64-linux and aarch64-darwin; it looks like a fix was merged in the issues you linked. @aldafu can you confirm and if so close?