I’m really enjoying NixOS; thanks to all who have made it possible.
But, I’m having some problems when I work on R code development projects, and I hope someone can help me. Even though I’ve been using NixOS for a couple of years, I still only know the basics and don’t even know where to start.
Basically, as soon as I start editing an R file in vim, I see (in the top command output) that my CPU usage goes to 100%, because of (one or more) systemd-coredum
processes. When I quit vim, these go away. Also, if I just start R and load the devtools
package, then try to build()
or install()
the package I am working on, I get an error, like this:
> library(devtools)
Loading required package: usethis
> build()
*** buffer overflow detected ***: terminated
/nix/store/r3pf5fwxmvbkjksba0kic2l1i9sf91ni-R-4.0.4/lib/R/bin/build: line 10: 476437 Done echo 'tools:::.build_packages()'
476438 Aborted (core dumped) | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" --no-restore --no-echo --args ${args}
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'R' failed, exit status: 134, stdout + stderr:
E> *** buffer overflow detected ***: terminated
E> /nix/store/r3pf5fwxmvbkjksba0kic2l1i9sf91ni-R-4.0.4/lib/R/bin/build: line 10: 476437 Done echo 'tools:::.build_packages()'
E> 476438 Aborted (core dumped) | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" --no-restore --no-echo --args ${args}
Type .Last.error.trace to see where the error occured
Now, to install R, I basically followed the instructions in the Nixpkgs Manual (section 15.21, Nixpkgs 23.11 manual | Nix & NixOS). I created the following configuration file in .config/nixpkgs/config.nix
:
{
allowUnfree = true;
packageOverrides = super: let self = super.pkgs; in
{
rEnv = super.rWrapper.override {
packages = with self.rPackages; [
languageserver
spelling
knitr
lintr
yaml
devtools
tidyverse
shiny
data_table
flextable
kableExtra
mvtnorm
Formula
MatchIt
];
};
};
}
I’m sorry if this isn’t a really clear or helpful description of what is going on, but I’d be happy to provide any other information requested. Many thanks in advance.
UPDATE: I was able to diagnose the problem with opening R files in vim a bit. I traced it back to the coc.nvim plugin, which loads the R language server. I guess this is what was crashing. Still, any help fixing this, or the problem with devtools, is appreciated.