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

Implement URI resolution for Nix Flake input URIs #270

Open
PAI5REECHO opened this issue Oct 17, 2023 · 1 comment
Open

Implement URI resolution for Nix Flake input URIs #270

PAI5REECHO opened this issue Oct 17, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@PAI5REECHO
Copy link

nil implements a limited version of link resolution for Nix Flake input URIs. It turns Flake input URIs into clickable links (i.e. github:nix-community/nixd opens https://github.com/nix-community/nixd in default web browser): https://github.com/oxalica/nil/blob/73eeaa64d847f9db42e6d4f7bc80ca04011933a5/crates/ide/src/ide/links.rs#L74

It'd be nice to see a more complete version of this LSP functionality implemented in nixd, one that actually resolves (also recursively resolves) Flake input links fully and considers nix registry list for user defined registry URLs.

Some test case examples:

  • github:nix-community/nixd -> https://github.com/nix-community/nixd
  • github:nix-community/nixd/29904e121cc775e7caaf4fffa6bc7da09376a43b -> https://github.com/nix-community/nixd/commit/29904e121cc775e7caaf4fffa6bc7da09376a43b
  • github:nix-community/nixd?ref=pull/252/head -> https://github.com/nix-community/nixd/pull/252
  • blender-bin -> https://github.com/edolstra/nix-warez/tree/master/blender
  • gitlab:openldap/openldap?host=git.openldap.org -> https://git.openldap.org/openldap/openldap
@inclyc inclyc added documentation Improvements or additions to documentation enhancement New feature or request and removed documentation Improvements or additions to documentation labels Oct 18, 2023
@inclyc
Copy link
Member

inclyc commented Oct 18, 2023

Actually there do have some "patterns" in nix files, which is the type system in nil, but in nixd for now all files are treated equally.

For example, we currently do not have any type system or assumption that flake.nix is actually a flake root, this should be carefully introduced to maintain consistency between nixd and official one.

It'd be nice to see a more complete version of this LSP functionality implemented in nixd, one that actually resolves (also recursively resolves) Flake input links fully and considers nix registry list for user defined registry URLs.

I agree that this would be nice. Maybe a queued feature after new languages frontend merged?

fully and considers nix registry list for user defined registry URLs.

To do this I think the best solution is just sharing the same code with official nix, however there might be some refactor in upstream (e.g. introducing libnixflake) for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants