Skip to content

rix(r_pkgs = "<rpkg@version>") Nix expression should assign to cran_build_pkgs instead of git_archive_pkgs variable #348

@philipp-baumann

Description

@philipp-baumann
library("rix")

rix(
  r_ver = "latest",
  r_pkgs = "[email protected]",
  project_path = ".",
  overwrite = TRUE
)

nix_build(project_path = ".")

currently produces this Nix expression

# This file was generated by the {rix} R package v0.12.4 on 2024-10-03
# with following call:
# >rix(r_ver = "1839883cd0068572aed75fb9442b508bbd9ef09c",
#  > r_pkgs = "[email protected]",
#  > project_path = "_test",
#  > overwrite = TRUE)
# It uses nixpkgs' revision 1839883cd0068572aed75fb9442b508bbd9ef09c for reproducibility purposes
# which will install R version latest.
# Report any issues to https://github.com/ropensci/rix
let
 pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/1839883cd0068572aed75fb9442b508bbd9ef09c.tar.gz") {};
  
  git_archive_pkgs = [ 
    (pkgs.rPackages.buildRPackage {
      name = "rlang";
      src = pkgs.fetchzip {
       url = "https://cran.r-project.org/src/contrib/Archive/rlang/rlang_1.1.3.tar.gz";
       sha256 = "sha256-+xSUK2YpQHE0sezKMngihHVKG0r63b6OuJb6136qgRM=";
      };
      propagatedBuildInputs = builtins.attrValues {
        inherit (pkgs.rPackages) ;
      };
    })
  ];
   
  system_packages = builtins.attrValues {
    inherit (pkgs) 
      glibcLocales
      nix
      R;
  };
  
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   system_packages   ];
  
}

It should be tagged under cran_build_pkgs. Its the same hashing procedure, but semantically its not a git archive.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions