tweag / HaskellR

The full power of R in Haskell.

Home Page:https://tweag.github.io/HaskellR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inline-r picks up incorrect version R

idontgetoutmuch opened this issue · comments

I have

let

rOverlay = rself: rsuper: {
  myR = rsuper.rWrapper.override {
    packages = with rsuper.rPackages; [
      ggplot2
      dplyr
      xts
      purrr
      cmaes
      cubature
    ];
  };
  R = rsuper.R.overrideAttrs (oldAttrs: {
    configureFlags = [ "--without-x" ];
  });
};

in

let

  nixpkgs = import <nixpkgs> { config.allowBroken = true; overlays = [ rOverlay ]; };

  haskellDeps = ps: with ps; [
    Frames
    (nixpkgs.haskell.lib.dontCheck inline-r)
    lens text vinyl
  ];

in

  nixpkgs.stdenv.mkDerivation {
  name = "env";
  buildInputs = [
    (nixpkgs.haskellPackages.ghcWithPackages haskellDeps)
    nixpkgs.myR
  ];
}

and in my nix shell I can run R

[nix-shell:~/bench-analysis]$ which R
which R
/nix/store/hxkavy6gx0vl552c6hf79x83nir7vbr2-R-4.0.4-wrapper/bin/R

but if I launch ghci in the same shell and use inline-r with

        R.runRegion $ do
          [r| print(file.path(R.home("bin"), "R")) |]

I get

"/nix/store/0aj20v34rmbgwn8sbf6kx5i38h6km3ag-R-4.0.4/lib/R/bin/R"

How is inline-r finding this? It's not on the path. In fact I can check this

*Main> :! which R
:! which R
/nix/store/hxkavy6gx0vl552c6hf79x83nir7vbr2-R-4.0.4-wrapper/bin/R

This might be the reason (in hackage-packages.nix)

       libraryPkgconfigDepends = [ R ];

but thus far I have failed persuade this R to be my custom R.