What's Changed
This version primarily focuses on enhancing primop (builtin) support in nixd.
Context: NixOS/nixpkgs#449123
New Features
Validate builtins members: (by @inclyc)
nixd now checks if a member accessed via builtins actually exists. If an unknown primop is detected, a diagnostic error is triggered.
builtins.concatStringSep
# ^ Error: Unknown primopSuggest removing redundant builtins. prefixes: (by @inclyc)
For globally available primops (like map), nixd will suggest removing the builtins. prefix to keep the code concise.
builtins.map
# ^^^^^ Hint: 'map' is globally available; 'builtins.' is unnecessary.Suggest to add builtins prefixes: (by @inclyc)
Give warnings when user code overrides built-in names (by @inclyc)
Special thanks to @Mic92 for the suggestion!
In the Nix language, it is possible to override (shadow) builtin names. However, this is generally considered a bad practice as it is highly error-prone. For example:
nix-repl> let
__lessThan = a: b: true;
in
2 < 1
true
Now nixd will place a warning on __lessThan definition:
overriding a builtin name `__lessThan` is discouraged, rename it to avoid confusion
Bug Fixes
- libnixf/Sema: make constants available in
builtinsattrset by @inclyc in #723 - libnixf/package: fix
meta.mainProgramby @jfly in #730 - libnixf/Sema: fixes #731 by creating a trivial env for empty let-in exprs by @inclyc in #734
- libnixf/Sema: allow
inherit (builtins) varby @inclyc in #741
Documentation
- docs: remove $ from editors.md by @melonSorbet in #737
Other Changes
- nixd/Controller: clear diagnostics when removing document by @rszyma in #716
- build(deps): bump actions/upload-artifact from 4 to 5 by @dependabot[bot] in #725
- build(deps): bump actions/checkout from 5 to 6 by @dependabot[bot] in #729
New Contributors
- @rszyma made their first contribution in #716
- @jfly made their first contribution in #730
- @melonSorbet made their first contribution in #737
🎉 Event Announcement
I’ll be giving a talk on nixd at the NixOS CN Meetup #2, slides. This session is tailored for the Chinese NixOS community, and I’m looking forward to sharing some insights with you all. 欢迎一起交流 ❤️ .
Full Changelog: 2.7.0...2.8.0