Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R: install packages from DESCRIPTION file #1612

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pchabros
Copy link
Contributor

PR works but I need some help:

  1. I've created r/ subdirectory to split code into separate files, but it broke generated docs - can I fix it somehow or I should not create subdirectory?
  2. I wanted descriptionFile.path to be relative path (./DESCRIPTION) or just a string ("./DESCRIPTION") but after concatenating it with config.devenv.root I got error: access to absolute path '/home' is forbidden in pure evaluation mode - how can I move absolute path to nix-store? Or somehow evaluate relative path in context of devenv.nix instead of modules/languages/r.nix?
  3. I've created utils/strings.nix with some generic functions. Should I put it somewhere else?

@b-rodrigues
Copy link

Sorry, I’m very new to devenv, but am involved quite a bit with the R ecosystem in Nix. Could you explain what this would achieve? My understanding was that devenv provides the right build dependencies to build any R package, so wouldn’t trying to install an R packages using devenv result in its dependencies also be pulled from CRAN, as they’re listed in "depends"?

@pchabros
Copy link
Contributor Author

No, it doesn't pull anything from CRAN. It just automatically adds all packages listed in DESCRIPTION file to packages. So, let's assume that you have the following DESCRIPTION file, than instead of copying and pasting dependencies to devenv.nix:

{
  languages.r.enable = true;
  packages = with pkgs.rPackages; [
    readr
    stringr
    data_table
    yaml
    testthat
  ];
}

you can just enable this option:

{
  languages.r = {
    enable = true;
    descriptionFile = {
      path = "${./DESCRIPTION}";
      installPackages.enable = true;
    };
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants