Navigation Menu

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

rust-analyzer: init at unstable-2020-03-09 #77752

Merged
merged 11 commits into from Apr 14, 2020
Merged

Conversation

oxalica
Copy link
Contributor

@oxalica oxalica commented Jan 15, 2020

Motivation for this change

Add rust-analyzer, an experimental modular compiler frontend for the Rust language.
Also add the vscode extension.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@arcnmx
Copy link
Member

arcnmx commented Jan 15, 2020

It might be nice if we could split this up into an unwrapped and wrapped derivation. rustcSrc makes a fair dent in the closure size when it might just be overridden and unused (my typical use of it is to wrap it as part of a shell for a specific rust channel).

Also someone with ofborg permissions may want to initiate a darwin build. In the past I've had to include buildInputs = optionals hostPlatform.isDarwin [ darwin.cf-private darwin.apple_sdk.frameworks.CoreServices ]; but haven't checked in a while if it's still necessary.

Finally, not an important point, but I wondered if we could/should build it with the jemalloc feature? I think features still can't be combined with cargo's -p flag yet though so :(

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would split this into two commits:

rust-analyzer: init at unstable-2020-01-13
vscode-extensions.rust-analyzer: init at unstable-2020-01-13

@oxalica
Copy link
Contributor Author

oxalica commented Jan 18, 2020

@arcnmx
That's great. But it's not easy to build two packages with features on using a single cargo command. I read the docs of rust-analyzer, and the binary ra_cli is development-only and seems just for benchmarks. To make it easy, I just build the language server ra_lsp_server.
Also, it builds on darwin now.

@jonringer
Splitted.

@oxalica
Copy link
Contributor Author

oxalica commented Jan 21, 2020

Updated to 2020-01-20

@oxalica oxalica changed the title rust-analyzer: init at unstable-2020-01-13 rust-analyzer: init at unstable-2020-01-20 Jan 21, 2020
evanjs added a commit to evanjs/nixos_cfg that referenced this pull request Jan 25, 2020
- wait until rust-analyzer is merged into nixpkgs
  (NixOS/nixpkgs#77752)
@oxalica oxalica force-pushed the rust-analyzer branch 2 times, most recently from 703cc08 to 2164a0f Compare January 29, 2020 19:48
@oxalica
Copy link
Contributor Author

oxalica commented Jan 29, 2020

  • Rebased and updated to unstable-2020-01-29.
  • Make the vscode extension to use unstable- prefixed version of rust-analyzer, since it is also unstable.
  • Add maintainers.
  • Some tiny fixes.

@oxalica oxalica changed the title rust-analyzer: init at unstable-2020-01-20 rust-analyzer: init at unstable-2020-01-29 Jan 29, 2020
@oxalica
Copy link
Contributor Author

oxalica commented Feb 10, 2020

Latest version 2020-02-10 is blocked by #79148, which is merged into staging but not in master yet.

@oxalica
Copy link
Contributor Author

oxalica commented Feb 15, 2020

Rebased and bumped to 2020-02-11.
Also fixed update script.

@oxalica
Copy link
Contributor Author

oxalica commented Feb 25, 2020

Bumped to 2020-02-25 and fix binary name.

@oxalica
Copy link
Contributor Author

oxalica commented Mar 4, 2020

  • Bump to 2020-03-02.
  • Setup fake rustup in checkPhase to avoid patching test code.
  • Fix update script.

@oxalica oxalica changed the title rust-analyzer: init at unstable-2020-01-29 rust-analyzer: init at unstable-2020-03-02 Mar 4, 2020
@lovesegfault
Copy link
Member

@oxalica Oh, right, I forgot staging still hasn't been merged. :(

@lovesegfault
Copy link
Member

Pinging @jonringer @worldofpeace for a possible merge.

@lovesegfault
Copy link
Member

@oxalica 1.42 is in master, you should be able to update this now I think.

Pinging @jonringer for a review.

@oxalica
Copy link
Contributor Author

oxalica commented Apr 8, 2020

Do we really need to separate files and commits about rust-analyzer and vscode-extensions.rust-analyzer? They are always updated together.
Would it be better to move the extension derivation (with node-packages.nix) to pkgs/development/tools/rust/rust-analyzer and make a single update commit?

@bqv
Copy link
Contributor

bqv commented Apr 8, 2020

They're separate packages. It's fine for the update commits to always come in pairs, and there's no harm in more granularity

@oxalica
Copy link
Contributor Author

oxalica commented Apr 8, 2020

@bqv Note that vscode-extensions.rust-analyzer references rust-analyzer.src but has separated node-packages.nix. So the extension may break when someone checkout the commit of rust-analyzer, due to outdated node-packages.nix.

@bqv
Copy link
Contributor

bqv commented Apr 8, 2020

Granted I'm not overly familiar with vsix instrumentation in nix, but perhaps in this scenario it would be better to have the extension as an output of the main package then? I do see your point, however. My other solution would be to break the dependency between the packages. The duplication isn't too much of an issue since the source would be reused (identical hash) anyway.

@oxalica
Copy link
Contributor Author

oxalica commented Apr 8, 2020

@bqv

... it would be better to have the extension as an output of the main package then?

The extension is a node package but rust-analyzer itself is a rust package. We cannot mix them together.

@bqv
Copy link
Contributor

bqv commented Apr 8, 2020

In that case I would suggest refer to the source twice, once in each derivation/commit (unless anyone thinks that's a bad idea)

@Mic92
Copy link
Member

Mic92 commented Apr 14, 2020

Thanks!

@asdf8dfafjk
Copy link
Contributor

I like your wrapping approach and would prefer this package stays , since per project shell.nix could be different, and hence the argument to rust-analyzer, that said, its probably worth mentioning that rust-analyzer is now part of standard rust distribution. rust-lang/rust#72978

@oxalica
Copy link
Contributor Author

oxalica commented Aug 28, 2020

@asdf8dfafjk
As a compiler-independent tool, I think we cannot benefit a lot from using dist from rust toolchain.

In nixpkgs, we have only stable rustc and cargo, bootstrapped from previous stable version.
That's quite a long time between two stable release of rust, but rust-analyzer could be more actively updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants