b-rodrigues / rix

Reproducible development environments for R with Nix
https://b-rodrigues.github.io/rix/
GNU General Public License v3.0
102 stars 11 forks source link

Should it be possible to drop into the R console from the nix-shell and build script within that environment? #188

Closed VtheRtech closed 1 day ago

VtheRtech commented 1 week ago

Discussed in https://github.com/b-rodrigues/rix/discussions/182

Originally posted by **VtheRtech** June 10, 2024 Hello Everyone! I have had some fun running this package, great work so far! One thing I'm having some difficulty with is running R code through the console while in the shell environment. I can run my script through the command line with no issues, and I believe the utility is there for locking in analysis to a specific version of R after the whole script is written and debugged. [here is the script I have been testing](https://github.com/VtheRtech/trade-union-behaviour-2020s) [Here is neovim configurations I am using along with associated .Rprofile in the readme](https://github.com/VtheRtech/Vim-Config-Files.git) I am curious is this mainly an issue with the environment I'm running? or perhaps I should be running the `env_build.R` script every time to enter the environment that was built using nix within the R console? Below is better visual show case of what I am trying to do: ![image](https://github.com/b-rodrigues/rix/assets/30744769/3bb11a84-69e7-4635-8102-00e8e82a6b6c) When I try going to my text editor through the nix-shell these errors appear the environment doesn't seem to work. R doesn't see `{targets}` or any other relevant package installed. ``` before_rns.R stderr: .build_packages() exit status 0 * installing to library ‘/nix/store/zci0ali173n6dar8w2ga3jvlalivd0s1-r-here-1.0.1/library’ Error: ERROR: no permission to install to directory ‘/nix/store/zci0ali173n6dar8w2ga3jvlalivd0s1-r-here-1.0.1/library’ Error in do_exit(status = status) : .install_packages() exit status 1Execution halted before_rns.R stdout: * checking for file ‘/home/pretender/.local/share/nvim/lazy/R.nvim/nvimcom/DESCRIPTION’ ... OK * preparing ‘nvimcom’: * checking DESCRIPTION meta-information ... OK * cleaning src * checking for LF line-endings in source and make files and shell scripts * checking for empty or unneeded directories * building ‘nvimcom_0.9.41.tar.gz’ Time: global setup: 0.005199992 before_rns.R (async): 0.394760645 check health (async): 0.001037178 unix setup: 3.0948e-05 ``` Would there be way to add: ``` r options( languageserver.server_capabilities = list(completionProvider = FALSE, completionItemResolve = FALSE)) ``` To a rix file so that it will build an R profile with those options? The culprit has to be the language server. If I disable and use the cmp plugin instead I think it should work.
philipp-baumann commented 1 week ago

Hey @VtheRtech

I just once briefly tested nvim with R, but not really much expertise to debug. Maybe this for the failing nvim installation helps: https://nixos.wiki/wiki/Nvim-r

maybe this helps https://discourse.nixos.org/t/how-to-package-language-servers-with-nvim-override/18847/6

Cheers, Philipp

VtheRtech commented 6 days ago

I managed to wipe out my whole operating system and replace it with nixos, if I run into anything using that I will open another issue. But for now I'm assuming particular issue had to do with my configuration.

thanks for help. :)

philipp-baumann commented 5 days ago

I managed to wipe out my whole operating system and replace it with nixos, if I run into anything using that I will open another issue. But for now I'm assuming particular issue had to do with my configuration.

thanks for help. :)

great to hear you are using nixOS 👍 if you have any useful recommendations concerning a project-specific r-nvim setup that could be useful later for rix, you can still reopen later :-) cheers

VtheRtech commented 1 day ago

https://github.com/R-nvim/R.nvim/issues/159#issuecomment-2194747946

I was able to resolve this issue, it turns out it was a dependecy issue with R.nvim.

Also the maintainer made a post that might be an interesting read.