diff --git a/pkgs/by-name/re/rerun/0001-re_space_view_time_series-utils-patch-out-doctests-w.patch b/pkgs/by-name/re/rerun/0001-re_space_view_time_series-utils-patch-out-doctests-w.patch new file mode 100644 index 000000000000..d43ae339641e --- /dev/null +++ b/pkgs/by-name/re/rerun/0001-re_space_view_time_series-utils-patch-out-doctests-w.patch @@ -0,0 +1,31 @@ +From f6c5dde13a39bd149d892162e2ef72267f4c4a57 Mon Sep 17 00:00:00 2001 +From: Someone Serge +Date: Thu, 15 Feb 2024 18:05:16 +0000 +Subject: [PATCH] re_space_view_time_series: utils: patch out doctests w + unstable features + +--- + crates/re_space_view_time_series/src/util.rs | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/crates/re_space_view_time_series/src/util.rs b/crates/re_space_view_time_series/src/util.rs +index 83ce5362f..59d3b9734 100644 +--- a/crates/re_space_view_time_series/src/util.rs ++++ b/crates/re_space_view_time_series/src/util.rs +@@ -288,12 +288,7 @@ fn add_series_runs( + /// is finite `x == x.next_up().next_down()` also holds. + /// + /// ```rust +-/// #![feature(float_next_up_down)] +-/// // f64::EPSILON is the difference between 1.0 and the next number up. +-/// assert_eq!(1.0f64.next_up(), 1.0 + f64::EPSILON); +-/// // But not for most numbers. +-/// assert!(0.1f64.next_up() < 0.1 + f64::EPSILON); +-/// assert_eq!(9007199254740992f64.next_up(), 9007199254740994.0); ++/// // PATCHED OUT THE UNSTABLE float_next_up_down + /// ``` + /// + /// [`NEG_INFINITY`]: f64::NEG_INFINITY +-- +2.43.0 + diff --git a/pkgs/by-name/re/rerun/package.nix b/pkgs/by-name/re/rerun/package.nix new file mode 100644 index 000000000000..c2f3842a298c --- /dev/null +++ b/pkgs/by-name/re/rerun/package.nix @@ -0,0 +1,128 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + pkg-config, + stdenv, + binaryen, + rustfmt, + lld, + darwin, + freetype, + glib, + gtk3, + libxkbcommon, + openssl, + protobuf, + vulkan-loader, + wayland, + python3Packages, +}: + +rustPlatform.buildRustPackage rec { + pname = "rerun"; + version = "0.13.0"; + + src = fetchFromGitHub { + owner = "rerun-io"; + repo = "rerun"; + rev = version; + hash = "sha256-HgzzuvCpzKgWC8it0PSq62hBjjqpdgYtQQ50SNbr3do="; + }; + patches = [ + # Disables a doctest that depends on a nightly feature + ./0001-re_space_view_time_series-utils-patch-out-doctests-w.patch + ]; + + cargoHash = "sha256-qvnkOlcjADV4b+JfFAy9yNaZGaf0ZO7hh9HBg5XmPi0="; + + nativeBuildInputs = [ + (lib.getBin binaryen) # wasm-opt + + # @SomeoneSerge: Upstream suggests `mold`, but I didn't get it to work + lld + + pkg-config + protobuf + rustfmt + ]; + + buildInputs = + [ + freetype + glib + gtk3 + (lib.getDev openssl) + libxkbcommon + vulkan-loader + ] + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.AppKit + darwin.apple_sdk.frameworks.CoreFoundation + darwin.apple_sdk.frameworks.CoreGraphics + darwin.apple_sdk.frameworks.CoreServices + darwin.apple_sdk.frameworks.Foundation + darwin.apple_sdk.frameworks.IOKit + darwin.apple_sdk.frameworks.Metal + darwin.apple_sdk.frameworks.QuartzCore + darwin.apple_sdk.frameworks.Security + ] + ++ lib.optionals stdenv.isLinux [ (lib.getLib wayland) ]; + + env.CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld"; + + addBuildInputRunpathsPhase = '' + declare _extraRunpaths + _sep= + for p in "''${pkgsHostTarget[@]}" ; do + if [[ -d "$p/lib" ]] ; then + _extraRunpaths+="$_sep$p/lib" + if [[ -z "$_sep" ]] ; then + _sep=: + fi + fi + done + + elfHasDynamicSection() { + patchelf --print-rpath "$1" >& /dev/null + } + + while IFS= read -r -d $'\0' path ; do + if elfHasDynamicSection "$path" ; then + patchelf "$path" --add-rpath "''${_extraRunpaths}" + fi + done < <( + for o in $(getAllOutputNames) ; do + find "''${!o}" -type f -and "(" -executable -or -iname '*.so' ")" -print0 + done + ) + + unset _extraRunpaths + unset _sep + ''; + + postPhases = lib.optionals stdenv.isLinux [ "addBuildInputRunpathsPhase" ]; + + cargoTestFlags = [ + "-p" + "rerun" + "--workspace" + "--exclude=crates/rerun/src/lib.rs" + ]; + + passthru.tests = { + inherit (python3Packages) rerun-sdk; + }; + + meta = with lib; { + description = "Visualize streams of multimodal data. Fast, easy to use, and simple to integrate. Built in Rust using egui"; + homepage = "https://github.com/rerun-io/rerun"; + changelog = "https://github.com/rerun-io/rerun/blob/${src.rev}/CHANGELOG.md"; + license = with licenses; [ + asl20 + mit + ]; + maintainers = with maintainers; [ SomeoneSerge ]; + mainProgram = "rerun"; + }; +} diff --git a/pkgs/development/python-modules/rerun-sdk/default.nix b/pkgs/development/python-modules/rerun-sdk/default.nix new file mode 100644 index 000000000000..7c6c13be63a2 --- /dev/null +++ b/pkgs/development/python-modules/rerun-sdk/default.nix @@ -0,0 +1,70 @@ +{ + buildPythonPackage, + lib, + rustPlatform, + stdenv, + attrs, + numpy, + pillow, + pyarrow, + rerun, + torch, + typing-extensions, + pytestCheckHook, + python, +}: + +buildPythonPackage { + pname = "rerun-sdk"; + inherit (rerun) version; + pyproject = true; + + inherit (rerun) src; + inherit (rerun) cargoDeps; + + nativeBuildInputs = [ + rustPlatform.cargoSetupHook + rustPlatform.maturinBuildHook + ]; + + propagatedBuildInputs = [ + attrs + numpy + pillow + pyarrow + typing-extensions + ]; + + buildAndTestSubdir = "rerun_py"; + + # https://github.com/NixOS/nixpkgs/issues/289340 + # + # Alternatively, one could + # dontUsePythonImportsCheck = true; + # dontUsePytestCheck = true; + postInstall = '' + rm $out/${python.sitePackages}/rerun_sdk.pth + ln -s rerun_sdk/rerun $out/${python.sitePackages}/rerun + ''; + + pythonImportsCheck = [ "rerun" ]; + + nativeCheckInputs = [ + pytestCheckHook + torch + ]; + + inherit (rerun) addBuildInputRunpathsPhase; + postPhases = lib.optionals stdenv.isLinux [ "addBuildInputRunpathsPhase" ]; + + disabledTestPaths = [ + # "fixture 'benchmark' not found" + "tests/python/log_benchmark/test_log_benchmark.py" + ]; + + meta = { + description = "Python bindings for `rerun` (an interactive visualization tool for stream data)"; + inherit (rerun.meta) changelog homepage license maintainers; + mainProgram = "rerun"; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 513046e930cd..065271af1130 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12680,6 +12680,8 @@ self: super: with self; { reretry = callPackage ../development/python-modules/reretry { }; + rerun-sdk = callPackage ../development/python-modules/rerun-sdk { }; + resampy = callPackage ../development/python-modules/resampy { }; resize-right = callPackage ../development/python-modules/resize-right { };