Installing rPackages.data_table with zlib headers with default.nix and direnv

Thanks for identifying this issue, zlib support wasn’t correctly being enabled as a pkg-config dependency was introduced some time ago and wasn’t noticed. I’ve resolved this in rPackages.data_table: add required pkg-config dependency by jbedo · Pull Request #236549 · NixOS/nixpkgs · GitHub.

FYI though, the way to do something like this in your shell expression is to override the data_table derivation with an overlay. Here’s an example adding the missing pkg-config dependency, modifying what you have above:

with import <nixpkgs> {
  overlays = [
    (_: super: {
      rPackages = super.rPackages.override {
        overrides = {
          data_table = super.rPackages.data_table.overrideDerivation (old: {
            nativeBuildInputs = old.nativeBuildInputs ++ [super.pkg-config];
          });
        };
      };
    })
  ];
}; let
  rlibs = with rPackages; [
    R
    Rcpp
    data_table
    roxygen2
    pkgbuild
  ];
in
  mkShell {
    nativeBuildInputs = [
      rlibs
    ];
  }
1 Like