ropensci / rix

Reproducible Data Science environments for R with Nix
https://docs.ropensci.org/rix/
GNU General Public License v3.0
180 stars 15 forks source link

Dealing with remotes for github packages #19

Closed b-rodrigues closed 1 year ago

b-rodrigues commented 1 year ago

like here: https://github.com/jimhester/lookup/blob/eba63db477dd2f20153b75e2949eb333a36cccfc/DESCRIPTION#L39

b-rodrigues commented 1 year ago

likely need to let highlite ... in ... propagatedBuildinputs

b-rodrigues commented 1 year ago

This expression deals with the {highlite} package, a dependency to the {lookup} package where both are only released on github:

let
 pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b200e0df08f80c32974a6108ce431d8a8a5e6547.tar.gz") {};
 highlite = [(pkgs.rPackages.buildRPackage {
    name = "highlite";
    src = pkgs.fetchgit {
      url = "https://github.com/jimhester/highlite";
      branchName = "master";
      rev = "767b122ef47a60a01e1707e4093cf3635a99c86b";
      sha256 = "sha256-lkWMlAi75MYxiBUYnLwxLK9ApXkWanA4Mt7g4qtLpxM=";
    };
    propagatedBuildInputs = builtins.attrValues {
      inherit (pkgs.rPackages) Rcpp BH;
    };
  }) ];
 rpkgs = builtins.attrValues {
  inherit (pkgs.rPackages) michelRodange;
};
 git_archive_pkgs = [(pkgs.rPackages.buildRPackage {
    name = "lookup";
    src = pkgs.fetchgit {
      url = "https://github.com/jimhester/lookup";
      branchName = "master";
      rev = "eba63db477dd2f20153b75e2949eb333a36cccfc";
      sha256 = "sha256-arl7LVxL8xGUW3LhuDCSUjcfswX0rdofL/7v8Klw8FM=";
    };
    propagatedBuildInputs = builtins.attrValues {
      inherit (pkgs.rPackages) gh memoise codetools crayon rex jsonlite rstudioapi withr httr Rcpp;
    } ++ [highlite];
  }) ];
 system_packages = builtins.attrValues {
  inherit (pkgs) R ;
};
  in
  pkgs.mkShell {
    buildInputs = [ git_archive_pkgs rpkgs system_packages  ];
      shellHook = ''
R --vanilla
'';
  }

thinking more about it, I'm not sure it is worth the trouble to be honest. These kind of packages are rare, and I think that documenting this in a vignette might be enough. What do you think @philipp-baumann ?

philipp-baumann commented 1 year ago

Hi @b-rodrigues very good question. I would assume this scenario is most likely for custom R packages that are part of a specific (data) workflow in an organization for example. I would do as proposed, document it a vignette, and once we feel there is a demand from the community we can support it in rix(). :-)

b-rodrigues commented 1 year ago

solved with df01613d59ba06c59ffa2c2d8f85a9b0dba755ee