typelevel / typelevel-nix

Development tools for Typelevel projects
Apache License 2.0
110 stars 12 forks source link

coursier #24

Open cquiroz opened 2 years ago

cquiroz commented 2 years ago

Another newbie question. In a new laptop using typelevel-nix I was able to build my code but to use metals I had to install coursier as an extra package I'm not sure if it should be included here as it seems to be a one-time install. WDYT?

rossabaker commented 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.

cquiroz commented 2 years ago

I'm using direnv but on starting the editor it complained metals wasn't installed. I'll keep researching this

vincenzobaz commented 1 year ago

@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?

armanbilge commented 1 year ago

@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

rossabaker commented 1 year ago

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.

vincenzobaz commented 1 year ago

I managed to get it working. Thank you both for the input