Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacs.pkgs.treesit-grammars: init fake package #230751

Merged
merged 1 commit into from
May 16, 2023

Conversation

DamienCassou
Copy link
Contributor

@DamienCassou DamienCassou commented May 8, 2023

Description of changes

Adding this package gives Emacs access to tree-sitter grammars.

How to test

Given that there is an emacs29 package, the changes in this PR can be tested with:

$ nix-build -E 'with import ./default.nix {}; pkgs.emacs29.pkgs.withPackages (epkgs: [(epkgs.treesit-grammars.with-grammars (grammars: [grammars.tree-sitter-bash]))])'
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: emacs Text editor label May 8, 2023
@DamienCassou
Copy link
Contributor Author

Result of nixpkgs-review pr 230751 run on x86_64-linux 1

@DamienCassou DamienCassou marked this pull request as ready for review May 8, 2023 18:27
@DamienCassou DamienCassou requested a review from adisbladis as a code owner May 8, 2023 18:27
@DamienCassou
Copy link
Contributor Author

/cc @clhodapp

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 8, 2023
@clhodapp
Copy link
Contributor

clhodapp commented May 9, 2023

Cool! I keep managing to falsely convince myself that linkFarm doesn't do subfolders like this. Taking advantage of it makes this much cleaner that what I would have done.

There are definitely some benefits to putting this where you're putting it so that it fits more ergonomically with emacsWithPackges. I guess the emacs package maintainers will need to sign off on it being OK to structure things like this.

One thing I will say: if this is going to go into nixpkgs, you should probably fix it so that it uses the correct shared library extension when building for Darwin. My code didn't do that because I was lazy and all of my machines are Linux at present.

Adding this package gives Emacs access to tree-sitter grammars.
@DamienCassou DamienCassou force-pushed the emacs-tree-sitter-grammars branch from 17d35f7 to e764298 Compare May 9, 2023 18:36
@DamienCassou
Copy link
Contributor Author

Result of nixpkgs-review pr 230751 run on x86_64-linux 1

@DamienCassou
Copy link
Contributor Author

/cc @adisbladis @jian-lin I would appreciate your feedback on this one. Thank you.

@DamienCassou
Copy link
Contributor Author

@clhodapp I took your feedback into account. Thank you very much.

@DamienCassou
Copy link
Contributor Author

If I don't get more feedback, I will soon merge this PR.

@wentasah
Copy link
Contributor

This works well for me. Thanks!

I've noticed that in addition to libtree-sitter-*.so the resulting derivation contains also:

libmarkdown_inline.so -> /nix/store/pbyd7m44l79jbg9q0mjjnjg7vcp78svi-markdown_inline-grammar-0.20.8/parser
liborg.so -> /nix/store/8wsmj257ifn6n5vj0ir405pphi12bdpa-org-grammar-0.20.8/parser

However, I don't think it can cause big problems other than not being able to load those grammars. And in case of org, emacs users will probably not want to use it.

Also, when one wants to use this with emacsUnstable (or maybe also emacsGit) from emacs-overlay, it is necessary to override the passtthru attribute and set treeSitter to true. Without that, treesit-extra-load-path variable is not set by the emacs wrapper. See this commit in my config.

@DamienCassou
Copy link
Contributor Author

Thank you very much for the feedback @wentasah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: emacs Text editor 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants