-
Notifications
You must be signed in to change notification settings - Fork 18
Using nix within Positron in a remote session (and fix docs about IDE) #472
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
Comments
I have no experience with this, but this thread might help: #387 (reply in thread) |
Thanks for the suggestion @b-rodrigues . I had a look at that post. I'm hoping to avoid the container route, because that is why I switched to rix/nix in the first place - no need to deal with root in the container, missing symlinks, etc. Honestly now I would be happy to get R within nix running in either VS Code or Positron, as long as I can access it via SSH. I have heavy computations that I can't run on my laptop. I think I need to use the local install of my IDE, because I had the same experience as @atsyplenkov with the frustratingly (IMHO unusably) slow response of the IDE within nix over SSH GUI. I've been testing with this repo: https://github.com/joelnitta/2025-04-18_nix. It works fine locally - from a terminal in VS Code I run However, when I try to do the same thing remotely (over SSH), although I know this is diverging from the OP, but if you have any ideas that would be great... |
Did you install direnv on the server and the corresponding extension on your local IDE? that seems to be the solution https://docs.ropensci.org/rix/articles/e-configuring-ide.html#configuring-native-vs-codecodium-on-your-operating-system |
So I did try that, but it doesn't seem to do anything. That is, I don't get the lag that you would expect while direnv runs I noticed there are multiple versions of |
maybe is it working locally when you switch folders, do you get the shell started? |
You mean something like this:
Should drop me into the nix shell? (where That isn't happening. |
yes if direnv is configured correctly |
opened a pr, it should be "use nix" |
OK got that. So at a minimum (not bothering with VS Code here), I should be able to:
? That is what I have tried, and I still see only my local shell. FYI,
|
did you hook your shell https://direnv.net/docs/hook.html |
No (it wasn't in the rix docs). Doing that does indeed seem to get Anyways, I would recommend a few (more) updates to the docs - clarifying about |
I'll update the docs, thanks so is it working then? can we close this ? |
Regarding your question about direnv vs nix-direnv, seems like both should be ok, but nix-direnv should be faster for nix based projects. However, it requires a modern bash, so they recommend direnv instead on macOS: https://github.com/nix-community/nix-direnv?tab=readme-ov-file#installation EDIT: no that's wrong: nix-direnv is actually an extension to direnv. So you need to install both! direnv alone works, but is not optimized for nix shells. With nix-direnv, it's actually much faster! |
fyi: 0cc73af |
I get the feeling this is out-of-scope for {rix}: I've confirmed (using local R install instead of R in nix) that the lack of plots or help menus when using R in VS Code remotely via SSH is due to the VS Code R extension, and it seems getting the nix env to show up in Positron's list of interpreters is a Positron thing. So let's consider the update to the docs sufficient to close this for now. |
OK but when positron connects does it now see the nix-managed R from the server with direnv ? or at least with VS code ? |
Positron: No, with a local (i.e., not from nix) install of Positron, even when opening the dir with VS Code: Local install of VS Code, connecting to the server with SSH then running R on the server in nix via direnv "works" (I can start an R terminal with |
In vscode, did you install the direnv extension as well ? |
(on a sidenote, I'm not confronted by such issues because because I use emacs in terminal mode directly from the server) |
Yes, that is working as expected. As soon as I open the project folder, I'm in the nix env, and the R terminal I open is from nix. |
so to summarize
|
yep.
I think this is because the VS Code R extension session watcher is not working when I connect via SSH. (as you can see the screenshot above) |
thanks a lot, this issue improved my understanding of remote ssh connections with a local editor and also the documentation |
FYI filed an issue about the VS Code R extension problem: REditorSupport/vscode-R#1604 |
I would like to connect to a remote server in Positron using the
Remote-SSH: Connect to host
command, then start an R Interpreter that is from a nix shell. Can you help me with this?My first attempt has been starting from Configuring Positron installed on macOS to interact with Nix shells. I first ran
"Install 'positron' command in PATH"
. Next, I connected to the server using my local Positron install, then rannix-shell
from a terminal in the remote session, but I don't see the nix instance in the menu of interpreters like I do when running locally.Thanks!
The text was updated successfully, but these errors were encountered: