For anyone that finds this in the future, as far as I can tell the only way around this is to use buildFHSUserEnv
(the following is what I needed for one of my projects, different projects will need different dependencies):
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in {
devShell = (pkgs.buildFHSUserEnv {
name = "2542";
targetPkgs = pkgs:
(with pkgs; [
binutils
cargo
curl.dev
gcc
libgit2
libxml2.dev
openssl.dev
pandoc
pkg-config
R
rPackages.renv
rustc
zlib.dev
]);
}).env;
});
}
The only thing (that I’ve tried) that fails with this is devtools::check()
, but even that works if you set vignettes = FALSE
(i.e. devtools::check(vignettes = F)
).
I wonder if it’s possible to create some kind of renv2nix
project so that this just works, but I don’t know renv’s (or in fact R’s) internals well enough.