From eae5d4cf75de9922bc3ab408fe76a4af441ebec1 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Tue, 23 Jun 2026 14:35:09 -0700 Subject: [PATCH 1/2] ark: init at 0.1.252 --- pkgs/by-name/ar/ark/package.nix | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 pkgs/by-name/ar/ark/package.nix diff --git a/pkgs/by-name/ar/ark/package.nix b/pkgs/by-name/ar/ark/package.nix new file mode 100644 index 000000000000..fbdbed890c23 --- /dev/null +++ b/pkgs/by-name/ar/ark/package.nix @@ -0,0 +1,55 @@ +{ + 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. + postInstall = '' + wrapProgram $out/bin/ark \ + --suffix PATH : ${lib.makeBinPath [ R ]} + ''; + + 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; + }; +}) From cf7043a63819420a57ea57ad514ab52cd4be3ba8 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Tue, 23 Jun 2026 14:40:08 -0700 Subject: [PATCH 2/2] ark: add a Jupyter kernel definition --- .../editors/jupyter-kernels/r-ark/default.nix | 31 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 ++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/applications/editors/jupyter-kernels/r-ark/default.nix diff --git a/pkgs/applications/editors/jupyter-kernels/r-ark/default.nix b/pkgs/applications/editors/jupyter-kernels/r-ark/default.nix new file mode 100644 index 000000000000..2c7a6be07046 --- /dev/null +++ b/pkgs/applications/editors/jupyter-kernels/r-ark/default.nix @@ -0,0 +1,31 @@ +{ ark }: + +# Jupyter notebook: +# nix shell --impure --expr 'with import ./. {}; [ (jupyter.override { definitions.r = r-ark-kernel.definition; }) ]' -c jupyter-notebook + +{ + definition = { + displayName = "Ark R Kernel"; + argv = [ + "${ark}/bin/ark" + "--connection_file" + "{connection_file}" + "--session-mode" + "notebook" + ]; + language = "R"; + # Ark logs at INFO to stderr by default, which includes Jupyter messages. + # The notebook forwards this to the cell output, so quiet it to warnings. + # + # The `ark::console::console_comm=error` directive additionally silences a + # per-cell "UI comm is absent during dispatch" warning: after every execute, + # ark unconditionally tries to push an environment-pane update over the + # Positron-only `positron.ui` comm, which a plain Jupyter frontend never + # opens. + env = { + RUST_LOG = "ark=warn,ark::console::console_comm=error"; + }; + logo32 = null; + logo64 = null; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bff44351dd14..14ada77305ed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2327,6 +2327,7 @@ with pkgs; definitions = { clojure = clojupyter.definition; octave = octave-kernel.definition; + r = r-ark-kernel.definition; # wolfram = wolfram-for-jupyter-kernel.definition; # unfree }; }; @@ -4557,6 +4558,8 @@ with pkgs; octave-kernel = recurseIntoAttrs (callPackage ../applications/editors/jupyter-kernels/octave { }); + r-ark-kernel = callPackage ../applications/editors/jupyter-kernels/r-ark { }; + octavePackages = recurseIntoAttrs octave.pkgs; # PHP interpreters, packages and extensions.