Open unode opened 4 years ago
Hello, I'm a bot and I thank you in the name of the community for opening this issue.
To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.
The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.
If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.
Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.
This is still an issue
I marked this as stale due to inactivity. → More info
I'd also like to know how to solve this! Thank you!
The relevant file appears to be https://github.com/NixOS/nixpkgs/blob/nixos-22.11/pkgs/development/r-modules/wrapper-rstudio.nix, and the environment variable (I believe?) is R_PROFILE_USER
not R_PROFILE_USER
Ah, anyone else who deals with this issue may be able to solve this by setting R_PROFILE
instead of R_PROFILE_USER
. Doesn't work for everyone, though
For instance, here's my flake.nix
for one of my projects:
outputs = { self, nixpkgs, utils } :
utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs {
inherit system;
overlays = [(self: super: {
customRstudio = super.rstudioWrapper.override {
packages = [super.rPackages.renv];
};
})
];};
in {
devShell = (pkgs.buildFHSUserEnv {
name = "renv-compatible nix";
targetPkgs = pkgs:
(with pkgs; [
binutils
curl.dev
gcc
libgit2
/* Needed for various R dependencies */
libssh
libpng
gdal
geos
freetype.dev
proj.dev
libxml2.dev
openssl.dev
sqlite.dev
pandoc
zlib.dev
unixODBC
libmysqlclient.dev
udunits
pkg-config
/* Needed for basic R setup */
R
rPackages.renv
customRstudio
]);
runScript = "bash";
profile = ''
export R_PROFILE=${builtins.toString ./.}/.Rprofile
'';
}).env;
});
}
Describe the bug A common mechanism to configure R is to create a
.Rprofile
file in the current directory, globally in~/.Rprofile
or setting the environment variableR_USER_PROFILE
. The current rstudio wrapper makes use of theR_USER_PROFILE
environment variable to inject additional paths via R's.libPaths()
. However, onceR_USER_PROFILE
is defined in the environment, R no longer checks for either of the two.Rprofile
locations mentioned (as can be read here). The fact that the wrapper usesR_USER_PROFILE
also prevents the user from relying on it to customize the session.To Reproduce Steps to reproduce the behavior:
nix-env -iA rstudio
~/.Rprofile
containingcat("Hello from .Rprofile")
.Expected behavior The file specified by the user in
R_USER_PROFILE
should be read or alternatively,.Rprofile
files should be read in the above mentioned locations.Additional context
R_USER_PROFILE
set in their environment, the wrapper should detect this and concatenate file specified by the user with the content of thefix_libs.R
file (into a temporary file?) and setR_USER_PROFILE
to this new location.R_USER_PROFILE
set, the wrapper should replicate R's behaviour and source.Rprofile
as described here.Notify maintainers @ehmry @changlinli @ciil
Metadata