ropensci / rix

Reproducible development environments for R with Nix
https://docs.ropensci.org/rix/
GNU General Public License v3.0
136 stars 12 forks source link

`rix` includes R as a package dependency #284

Closed artur-sannikov closed 3 weeks ago

artur-sannikov commented 3 weeks ago

Not sure why this happens. When installing several external packages from GitHub, rix includes R for one package as its dependency.

library(rix)

rix(
  r_ver = "frozen_edge",
  git_pkgs = list(
    list(
      package_name = "rix",
      repo_url = "https://github.com/b-rodrigues/rix/",
      commit = "008e3d1ac579cbcd4de3b9a2315635c652b687bd"
    ),
        list(
      package_name = "HoloFoodR",
      repo_url = "https://github.com/EBI-Metagenomics/HoloFoodR",
      commit = "815071128cdd8e099fbee032dd56fc12a14bfd00"
    ),
    list(
      package_name = "mia",
      repo_url = "https://github.com/microbiome/mia",
      commit = "dcaa110131162d48d82081d1da3a74da18268a3b"
    )
  ),
  r_pkgs = c(
    "ALDEx2",
    "BiocManager",
    "BiocVersion",
  ),
  system_pkgs = c("quarto"),
  ide = "code",
  project_path = ".",
  overwrite = TRUE,
  print = TRUE
)

The result is

# This file was generated by the {rix} R package v0.9.0 on 2024-08-29
# with following call:
# >rix(r_ver = "frozen_edge",
#  > r_pkgs = c("ALDEx2",
#  > "BiocManager",
#  > "BiocVersion"),
#  > system_pkgs = c("quarto"),
#  > git_pkgs = list(list(package_name = "rix",
#  > repo_url = "https://github.com/b-rodrigues/rix/",
#  > commit = "008e3d1ac579cbcd4de3b9a2315635c652b687bd"),
#  > list(package_name = "HoloFoodR",
#  > repo_url = "https://github.com/EBI-Metagenomics/HoloFoodR",
#  > commit = "815071128cdd8e099fbee032dd56fc12a14bfd00"),
#  > list(package_name = "mia",
#  > repo_url = "https://github.com/microbiome/mia",
#  > commit = "dcaa110131162d48d82081d1da3a74da18268a3b")),
#  >      ide = "code",
#  > project_path = ".",
#  > overwrite = TRUE,
#  > print = TRUE)
# It uses the `rstats-on-nix` fork of `nixpkgs` which provides bleeding
# edge packages and R.
# Only use bleeding edge packages if absolutely needed!
# Read more on https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html
# Report any issues to https://github.com/b-rodrigues/rix
let
 pkgs = import (fetchTarball "https://github.com/rstats-on-nix/nixpkgs/archive/1e0c3d0121347b5933ecd604a0b72d64ee9a7f8c.tar.gz") {};

  rpkgs = builtins.attrValues {
    inherit (pkgs.rPackages) 
      ALDEx2
      BiocManager
      BiocVersion
      languageserver;
  };

  git_archive_pkgs = [
    (pkgs.rPackages.buildRPackage {
      name = "rix";
      src = pkgs.fetchgit {
        url = "https://github.com/b-rodrigues/rix/";
        rev = "008e3d1ac579cbcd4de3b9a2315635c652b687bd";
        sha256 = "sha256-nrHHiHLYXehly0/qwhGvGmIgJrgyiW4kFIKJ1HvWQfg=";
      };
      propagatedBuildInputs = builtins.attrValues {
        inherit (pkgs.rPackages) 
          codetools
          curl
          jsonlite
          sys;
      };
    })

    (pkgs.rPackages.buildRPackage {
      name = "HoloFoodR";
      src = pkgs.fetchgit {
        url = "https://github.com/EBI-Metagenomics/HoloFoodR";
        rev = "815071128cdd8e099fbee032dd56fc12a14bfd00";
        sha256 = "sha256-Kwi/2RODbWDcQrHtGTPKox5Nv/LIWBUiTtwMRJjR4Xw=";
      };
      propagatedBuildInputs = builtins.attrValues {
        inherit (pkgs.rPackages) 
          R # This should not be here
          TreeSummarizedExperiment
          MultiAssayExperiment
          dplyr
          httr2
          jsonlite
          S4Vectors;
      };
    })

    (pkgs.rPackages.buildRPackage {
      name = "mia";
      src = pkgs.fetchgit {
        url = "https://github.com/microbiome/mia";
        rev = "dcaa110131162d48d82081d1da3a74da18268a3b";
        sha256 = "sha256-fPtt+mdz+2AFYvbRhlOFjRIA/oeTjZIEyV6X0T8NKRc=";
      };
      propagatedBuildInputs = builtins.attrValues {
        inherit (pkgs.rPackages) 
          SummarizedExperiment
          SingleCellExperiment
          TreeSummarizedExperiment
          MultiAssayExperiment
          MASS
          ape
          decontam
          vegan
          BiocGenerics
          S4Vectors
          IRanges
          Biostrings
          DECIPHER
          BiocParallel
          DelayedArray
          DelayedMatrixStats
          scuttle
          scater
          DirichletMultinomial
          rlang
          dplyr
          tibble
          tidyr
          bluster
          MatrixGenerics
          mediation
          rbiom;
      };
    })
   ];

  system_packages = builtins.attrValues {
    inherit (pkgs) 
      quarto
      R
      glibcLocales
      nix;
  };

in

pkgs.mkShell {
  LOCALE_ARCHIVE = if pkgs.system == "x86_64-linux" then  "${pkgs.glibcLocales}/lib/locale/locale-archive" else "";
  LANG = "en_US.UTF-8";
   LC_ALL = "en_US.UTF-8";
   LC_TIME = "en_US.UTF-8";
   LC_MONETARY = "en_US.UTF-8";
   LC_PAPER = "en_US.UTF-8";
   LC_MEASUREMENT = "en_US.UTF-8";

  buildInputs = [ git_archive_pkgs rpkgs  system_packages   ];

}

Both mia (https://github.com/microbiome/mia/blob/devel/DESCRIPTION) and HoloFoodR (https://github.com/EBI-Metagenomics/HoloFoodR/blob/devel/DESCRIPTION) include R as their dependency but rix does not include R as dependency of mia but does so for HoloFoodR.

b-rodrigues commented 3 weeks ago

The only differenc is see is the lack of a space character between "R" and the first "(" which I think may throw off the regexp that cleans this. Coould you do a quick fix and add the space to HolofoodR’s description and see if this is still there?

artur-sannikov commented 3 weeks ago

Yep, that worked :)