Files
nixpkgs/pkgs/by-name/ar/ark/package.nix

58 lines
1.5 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
cmake,
makeBinaryWrapper,
R,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "ark";
version = "0.1.252";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "posit-dev";
repo = "ark";
rev = finalAttrs.version;
hash = "sha256-AI8i15UMI+KSmweXkS/UYITZBOEDx/knjpK9SA2M+Ns=";
};
cargoHash = "sha256-z9l0dgmZO6f63I/2pms4VMXMxO/9SAZSq1OFubGHIpw=";
# The amalthea crate bundles libzmq via the zeromq-src crate, which builds it
# with CMake.
nativeBuildInputs = [
cmake
makeBinaryWrapper
];
# Only build the `ark` binary, not the whole workspace's test/dev crates.
cargoBuildFlags = [
"--package"
"ark"
];
# Tests require a running R installation and network access.
doCheck = false;
# Ark loads R dynamically at runtime, locating it via `R_HOME` or by running
# `R RHOME`. Put R on PATH so the kernel works out of the box. Also set
# R_LIBS_SITE so that ark can find installed packages.
postInstall = ''
wrapProgram $out/bin/ark \
--suffix PATH : ${lib.makeBinPath [ R ]} \
--prefix R_LIBS_SITE : "$(${lib.getExe' R "Rscript"} -e 'cat(Sys.getenv("R_LIBS_SITE"))')"
'';
meta = {
description = "R kernel for Jupyter applications, powering Positron's R support";
homepage = "https://github.com/posit-dev/ark";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ thomasjm ];
mainProgram = "ark";
platforms = lib.platforms.unix;
};
})