Skip to content

Instantly share code, notes, and snippets.

@Zhen-hao
Created April 25, 2020 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zhen-hao/8bdc7b2afe10f270f3f7e280a89c5ef0 to your computer and use it in GitHub Desktop.
Save Zhen-hao/8bdc7b2afe10f270f3f7e280a89c5ef0 to your computer and use it in GitHub Desktop.
how to use apache arrow in R on NixOS
let
old-arrow-cpp = import (
builtins.fetchTarball {
name = "old-arrow-cpp";
url = https://github.com/nixos/nixpkgs/archive/cdbf3f78bfd1f88259116f6f7cbcc6c5df0a9687.tar.gz;
# Hash obtained using `nix-prefetch-url --unpack <url>`
sha256 = "1j0lrjcqfp5pp54ls3wc054yyi4s6wpabs00d7sy9640fdrh8bd4";
}
) {};
arrow-cpp-overlay = self: super: {
inherit (old-arrow-cpp) arrow-cpp;
};
pkgs =
import <nixpkgs>
{
overlays = [
arrow-cpp-overlay
];
};
my-R-packages = with pkgs; with rPackages; [
devtools
arrow
];
R-with-my-packages = with pkgs; rWrapper.override{ packages = with rPackages; my-R-packages; };
in
pkgs.mkShell {
buildInputs = [ pkgs.arrow-cpp my-R-packages ];
name = "arrow-shell";
# See https://arrow.apache.org/docs/r/articles/install.html#how-dependencies-are-resolved
shellHook = ''
export LIBARROW_BINARY=${pkgs.arrow-cpp}/lib
export ARROW_USE_PKG_CONFIG=TRUE
export LIBARROW_DOWNLOAD=FALSE
export LIBARROW_BUILD=FALSE
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment