Change:
installTargets = [ "install" "install-info" "install-pdf" ]; <ins> # move tex files to $tex for use with texlive.combine # add link in $out since ${R_SHARE_DIR}/texmf is hardcoded in several places postInstall = '' mv -T "$out/lib/R/share/texmf" "$tex" ln -s "$tex" "$out/lib/R/share/texmf" ''; </ins> # The store path to "which" is baked into src/library/base/R/unix/system.unix.R, # but Nix cannot detect it as a run-time dependency because the installed file # is compiled and compressed, which hides the store path.

Discussion:
The R package in nixpkgs produces the directory which has files like . These files (to my knowledge) serve only to allow LaTeX to use the files which Sweave produces - but texlive can't exactly find them. I would solve this myself but I don't yet know Nix well enough. If anyone could point to any packages that solve a similar problem, that would help. Install and (other texlive packages may work similarly). Save the below as : Then run: R CMD Sweave example.Rnw latex latex will halt with: ! LaTeX Error: File `' not found. This has a somewhat kludgey workaround in the form of instead running something like: TEXINPUTS=".:/nix/store/i8cbhc7q0l1lkq3ynzxx0q5dh4s3dmd1-R-3.2.3/lib/R/share/texmf/tex/latex:" latex System: 16.09.1324. (Flounder) Nix version: nix-env (Nix) 1.11.4 Nixpkgs version: "16.09.1324."
Did you try to create a texlive variant which includes R? Updated example
Did you try this? This might be a novice error, but from that I am only able to get: error: attribute ‘pkgs’ missing, at /nix/store/2jr0yrapv1j4igmgai0nhddg9naqggg7-nixos-
The code I posted was not correct. The following commit make it at least compile: However I did not check the actually functionality: If works for you, feel free to submit a pull request.
That won't work by itself, as expects contents directly in the root of the package.
mhm. Adding a symlink in the package or a split package might help here.
(sorry hit the wrong button)
Yes, it might work to have a simple symlink package with the additional attributes from your commit (i.e. without changing R altogether).
By that, do you mean symlinking to in R's root?
No, creating a simple wrapper "package" that only contains that symlink and those attributes.
Does texlive run through a wrapper?

Would it be any simpler to optionally modify that wrapper to include R's LaTeX dependencies in one of the environment variables that texlive uses?
is a huge wrapper-builder that aggregates all the packages passed to it (and adds lots of magic to make it all work together, mostly). I do not think that changing it directly would be easier.
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly: for maintainers and people that previously touched the related code and @ mention them in a comment. on the . on the on .
Start R with administrator privileges. library("tinytex") r_texmf(action = "add")