GramEditor/gram
38
985
Fork
You've already forked gram
88

Auto-compilation of Extensions doesn't work on nixOS #58

Closed
opened 2026年03月07日 18:55:03 +01:00 by cyrneko · 4 comments

Gram downloads a dynamically compiled binary as part of the extension compilation process, which doesn't fly on nixOS without the use of stub-ld.

This makes any extensions being compiled, well, not compile.

Relevant log snippet:

Caused by:
 failed to compile nix parser with clang: Could not start dynamically linked executable: /home/alexia/.local/share/gram/extensions/build/wasi-sdk/bin/clang
 NixOS cannot run dynamically linked executables intended for generic
 linux environments out of the box. For more information, see:
 https://nix.dev/permalink/stub-ld
 
2026年03月07日T18:57:32+01:00 ERROR [crates/extension_host/src/extension_host.rs:601] failed to compile grammar 'nix'
Caused by:
 failed to compile nix parser with clang: Could not start dynamically linked executable: /home/alexia/.local/share/gram/extensions/build/wasi-sdk/bin/clang
 NixOS cannot run dynamically linked executables intended for generic
 linux environments out of the box. For more information, see:
 https://nix.dev/permalink/stub-ld
 

Related to #54

Gram downloads a dynamically compiled binary as part of the extension compilation process, which doesn't fly on nixOS without the use of stub-ld. This makes any extensions being compiled, well, not compile. Relevant log snippet: ``` Caused by: failed to compile nix parser with clang: Could not start dynamically linked executable: /home/alexia/.local/share/gram/extensions/build/wasi-sdk/bin/clang NixOS cannot run dynamically linked executables intended for generic linux environments out of the box. For more information, see: https://nix.dev/permalink/stub-ld 2026年03月07日T18:57:32+01:00 ERROR [crates/extension_host/src/extension_host.rs:601] failed to compile grammar 'nix' Caused by: failed to compile nix parser with clang: Could not start dynamically linked executable: /home/alexia/.local/share/gram/extensions/build/wasi-sdk/bin/clang NixOS cannot run dynamically linked executables intended for generic linux environments out of the box. For more information, see: https://nix.dev/permalink/stub-ld ``` Related to #54
Owner
Copy link

Interesting, I guess it's the WASI SDK being downloaded. It should be possible to provide it via Nix so that nothing is downloaded, hopefully.

Interesting, I guess it's the WASI SDK being downloaded. It should be possible to provide it via Nix so that nothing is downloaded, hopefully.
Author
Copy link

Yeah it is the WASI SDK indeed, there's a note about this on #54

Yeah it is the WASI SDK indeed, there's a note about this on https://codeberg.org/GramEditor/gram/pulls/54
Owner
Copy link

I have made it so that Gram doesn't need to download anything to compile extensions, as long as the WASI sysroot bundle is available in the location where Gram expects it to be.

On mac this is $HOME/Library/Application Support/Gram/extensions/build/wasi-sysroot.

You can see the implementation here:

fn find_wasi_sysroot(&self)-> Result<PathBuf>{

In theory, this should make it possible to get things working on NixOS by installing the sysroot while installing Gram.

I have made it so that Gram doesn't need to download anything to compile extensions, as long as the WASI sysroot bundle is available in the location where Gram expects it to be. On mac this is `$HOME/Library/Application Support/Gram/extensions/build/wasi-sysroot`. You can see the implementation here: https://codeberg.org/GramEditor/gram/src/commit/53e4d8f5af49daf2f2f9eb66707cb122a222f58b/crates/extension/src/extension_builder.rs#L227 In theory, this should make it possible to get things working on NixOS by installing the sysroot while installing Gram.
Owner
Copy link

Going to close this, the Wasm compilation is never going to be perfect across all platforms and my inclination right now is to replace it and the current language support model with something more like how helix works.

Going to close this, the Wasm compilation is never going to be perfect across all platforms and my inclination right now is to replace it and the current language support model with something more like how helix works.
Sign in to join this conversation.
No Branch/Tag specified
main
test/wgpu-on-mac
test-ci/failing-test-mac
test/failing-test-mac
test/build-on-22-04
test/wgpu-present-mode-mailbox
v2.1
test/altgr-fix-again
test/2.0.0-rc1
test/linux-build
test/objc2
v1.2.1
3.0.1
3.0.0
2.2.0
2.1.2
2.1.1
2.1.0
2.0.0
1.2.1
1.2.0
1.1.0
1.0.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
GramEditor/gram#58
Reference in a new issue
GramEditor/gram
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?