Referencing R sf package can't find shared library but the root problem. The issue is that the .libPaths()
in the nix R session have a path to my global R library at the top, causing nix R package load to fail:
> .libPaths()
[1] "/home/michael/R/x86_64-pc-linux-gnu-library/4.3"
[2] "/nix/store/2sjlgab913pjh63qkydijz7zc2298l9d-r-box-1.2.0/library"
I tried looking for global files that could read some file or an environment variable being set, but could not find anything, and resolved to clumsily setting the environment variables to the local directory.
Who or what is setting this first path?
I have R installed globally on Ubuntu, and a nix flake with the following contents, with R_LIBS*
set to a dummy path.
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
rPackages = pkgs.rWrapper.override{
packages = with pkgs.rPackages; [
box
languageserver
];
};
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs = [rPackages];
shellHook = ''
export R_LIBS=.
export R_LIBS_USER=.
export R_LIBS_SITE=.
export LC_ALL=C.UTF-8
'';
};
};
});
}
Any help would be greatly appreciated!