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

metals: init at 0.3.2 #51988

Closed
wants to merge 2 commits into from
Closed

metals: init at 0.3.2 #51988

wants to merge 2 commits into from

Conversation

ceedubs
Copy link
Contributor

@ceedubs ceedubs commented Dec 14, 2018

Metals is a language server for the
Scala programming language.

Motivation for this change

Metals is a very useful piece of a Scala development environment, and being able to set up one's development environment through Nix is useful for reproducibility and the ability to perform rollbacks.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

[Metals](https://scalameta.org/metals/) is a language server for the
Scala programming language.
@joachifm
Copy link
Contributor

@GrahamcOfBorg build metals


let
baseName = "metals";
version = "0.3.1";

Choose a reason for hiding this comment

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

v0.3.2 is out. Once this PR is merged we can update our release process (https://github.com/scalameta/metals/blob/master/RELEASING.md) to make sure this nix installation stays up-to-date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated to 0.3.2 a few days ago. I know that there was a 0.3.3 patch, but I'm not sure whether I should update this PR or if it's easier to get it merged if we freeze it and submit updates in future PRs.

Choose a reason for hiding this comment

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

Updating in separate PR sounds good 👍 I've already updated our release checklist to bump up the version/outputHash here https://github.com/scalameta/metals/blob/master/RELEASING.md

-Xmx4G
-Dmetals.client=vim-lsc
'';
maintainers = with maintainers; [ ceedubs ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add coconnor as a maintainer as well. (that's myself) I'm happy to handle updates in case ceedubs is unavailable or occupied.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Also added coconnor as a maintainer per request.
@ceedubs ceedubs changed the title metals: init at 0.3.1 metals: init at 0.3.2 Dec 14, 2018
description = "Language server for Scala";
longDescription = ''
This executable includes a minimal number of flags by default, and when
using it, you will likely want to pass in additional flags such as:
Copy link
Contributor Author

@ceedubs ceedubs Dec 18, 2018

Choose a reason for hiding this comment

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

I just realized that if you add additional arguments to the command as it's currently set up, they will be interpreted as arguments to the main method as opposed to as java flags (which is what the call probably wants). I'm going to close this out until we resolve this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coreyoconnor do you have any ideas on a good approach to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One possible approach is to do something like this: https://github.com/ceedubs/dotfiles/blob/282be59488af7b2a53eb69f6494bda75c870edef/metals/default.nix#L33

But this means that if someone wants to specify different java flags (ex: for emacs defaults), they have to change what they pass into the nix derivation as opposed to just changing a runtime flag that they pass to metals.

Ultimately I guess that what makes this kind of awkward is the positional nature of arguments passed into java (first flags then class name then main arguments).

Choose a reason for hiding this comment

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

It's not a big change in Metals to support regular cli argument -Dmetals.client=emacs. However, users should still be able to customize -Xmx and -Xms in my opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@olafurpg I agree. I don't see much benefit in changing metals to support the CLI argument. That might just serve to make it more confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

One mechanism is similar to @ceedubs referenced: Add a config param to the function that produces the derivation. When called using callPackage (as is the standard in nixpkgs) This can be overloaded in nixpkgs using the override function:

@ceedubs ceedubs closed this Dec 18, 2018
@liff
Copy link
Contributor

liff commented Mar 26, 2019

How come this was closed?

@ceedubs
Copy link
Contributor Author

ceedubs commented Mar 26, 2019

@liff I closed it because it wasn't clear to me how to provide a derivation that wasn't specific to a particular setup (ex: vim-lsc vs another client). The derivation that I use lives here. Feel free to use it, improve upon it, turn it into a better PR, etc.

Edit: @coreyoconnor's solution described here is probably the right approach, but I have never had a very good understanding of overrides and overlays, which is the main reason why I haven't pursued that further.

@liff
Copy link
Contributor

liff commented Mar 26, 2019

Since the official instructions seem to be to generate separate metals-$EDITOR scripts for each editor, how about if the derivation generates them all?

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

8 participants