Open cquiroz opened 2 years ago
My editor finds metals
on the $PATH
, and the right one is on the path because of direnv
. I don't have a global metals
install -- it's all self-contained, with no coursier install.
If your editor isn't hooked into direnv, you would probably have to have a global metals install? You could probably do that with home-manager, but I think a global one would be outside the scope of a dev shell.
I'm using direnv
but on starting the editor it complained metals
wasn't installed. I'll keep researching this
@cquiroz did you find a solution? Can you guys point to a tutorial or give me some hints on how to configure direnv with this flake?
@vincenzobaz I don't use direnv, but I understand you need to add an .envrc
file like this to your repository and explicitly direnv allow
for that folder.
https://github.com/typelevel/cats-effect/blob/7e24bb96d4921f4bb50bf439c3429bcff998f457/.envrc
My setup behaves like this:
$ cd ~
$ which metals
metals not found
$ cd ~/src/http4s
direnv: loading ~/src/http4s/.envrc
direnv: using flake
🔨 Welcome to http4s
[general commands]
menu - prints this menu
metals - Work-in-progress language server for Scala
sbt - A build tool for Scala, Java and more
scala-cli - Command-line tool to interact with the Scala language
[versions]
Java - 8.0.292
Node - 18.15.0
direnv: export +C_INCLUDE_PATH +DEVSHELL_DIR +IN_NIX_SHELL +JAVA_HOME +LIBRARY_PATH +LLVM_BIN +NIXPKGS_PATH +PRJ_DATA_DIR +PRJ_ROOT +name -TMPDIR ~PATH ~XDG_DATA_DIRS
$ which metals
/nix/store/63xf0hwwwqysdk5cx1mzd0ng30y8g0j1-devshell-dir/bin/metals
.envrc
is just:
use flake
And yes, every new project you need to do a direnv allow
, because direnv can execute nasty things, and you wouldn't want it on a project you don't trust.
I managed to get it working. Thank you both for the input
Another newbie question. In a new laptop using
typelevel-nix
I was able to build my code but to use metals I had to installcoursier
as an extra package I'm not sure if it should be included here as it seems to be a one-time install. WDYT?