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

Some R versions fail to build #213

Closed eliocamp closed 4 days ago

eliocamp commented 5 days ago

This nix config is failing to build:

library(rix)
rix(r_ver = "4.0.0",
    ide = "rstudio", 
    project_path = ".",
    overwrite = TRUE)

I get this error:

This derivation is not meant to be built, aborting

error: builder for '/nix/store/d31y68j06830b5k8avwk7b5xli86wk1j-nix-shell.drv' failed with exit code 1;
       last 4 log lines:
       > nobuildPhase
       >
       > This derivation is not meant to be built, aborting
       >
       For full logs, run 'nix log /nix/store/d31y68j06830b5k8avwk7b5xli86wk1j-nix-shell.drv'.

The full log doesn't have any more information:

warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/d31y68j06830b5k8avwk7b5xli86wk1j-nix-shell.drv^*'
@nix { "action": "setPhase", "phase": "nobuildPhase" }
nobuildPhase

This derivation is not meant to be built, aborting

Got the same error with R 3.6.3, 4.0.2, 4.0.3.

b-rodrigues commented 4 days ago

Thanks, it seems like shells couldn't be built at the time. So instead of doing nix-build then nix-shell, you can only use nix-shell. Try using nix-shell instead of nix-build and it should work. Thank you, will document this.

eliocamp commented 4 days ago

Ah, I didn't know there was a difference.

This

library(rix)
rix(r_ver = "4.0.0",
    ide = "rstudio", 
    r_pkgs = "pak",
    project_path = ".",
    overwrite = TRUE)

running with nix-shell throws an error:

[nix-shell:~/Documents/research/nixtest2]$ export QT_XCB_GL_INTEGRATION=none

[nix-shell:~/Documents/research/nixtest2]$ rstudio
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

(rstudio:570033): GLib-GIO-ERROR **: 22:33:25.470: Settings schema 'org.gnome.settings-daemon.plugins.xsettings' does not contain a key named 'antialiasing'
Trace/breakpoint trap (core dumped)

Strangely, if r_pkgs is NULL, then RStudio does boot up, but then crashes with #214.

b-rodrigues commented 4 days ago

For very old versions like that, I think it would be best not to use RStudio, if possible. But it depends what you want to achieve.

eliocamp commented 4 days ago

Ah, because the old version of RStudio might not be compatible with my "modern" system?

b-rodrigues commented 4 days ago

In theory that wouldn't be an issue, as Nix would pull all the required dependencies. However, in practice, because it's a graphical application it wouldn't surprise me if there could be issues, as is the case here. I don't know exactly what's the problem, but I wouldn't waste too much time trying to make an old version of RStudio work. For older versions like that, I would use another editor "outside" of Nix if I needed to work interactively. For example I use my system-installed Emacs and it works well. Probably you could use VSCode as well. Another option is to use subshells for old environments like this:

https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html

see in particular case 3

eliocamp commented 4 days ago

Would running rstudio server and using it from the browser work? (like with rocker containers)

b-rodrigues commented 4 days ago

probably, but never tried this