Running nixpkgs-update (https://nix-community.org/update-bot/) with UPDATE_INFO: mistral-rs 0.9.4 -> 0.9.5 https://github.com/EricLBuehler/mistral.rs/releases attrpath: mistral-rs Checking auto update branch... [version] [version] generic version rewriter does not support multiple hashes [rustCrateVersion] [rustCrateVersion] skipping because derivation has updateScript [golangModuleVersion] [golangModuleVersion] Not a buildGoModule package with vendorHash [npmDepsVersion] [npmDepsVersion] No npmDepsHash [updateScript] [updateScript] Success [updateScript] this derivation will be built: /nix/store/jqnnyv2s9y2mxjvmxj30nq3jayrpcz2y-packages.json.drv building '/nix/store/jqnnyv2s9y2mxjvmxj30nq3jayrpcz2y-packages.json.drv'... structuredAttrs is enabled Going to be running update for following packages: - mistral-rs-0.9.4 Press Enter key to continue... Running update for: Enqueuing group of 1 packages - mistral-rs-0.9.4: UPDATING ... - mistral-rs-0.9.4: DONE. Packages updated! Diff after rewrites: diff --git a/pkgs/by-name/mi/mistral-rs/package.nix b/pkgs/by-name/mi/mistral-rs/package.nix index e7e48296088c..c5276bdb042e 100644 --- a/pkgs/by-name/mi/mistral-rs/package.nix +++ b/pkgs/by-name/mi/mistral-rs/package.nix @@ -74,14 +74,14 @@ let in rustPlatform.buildRustPackage (finalAttrs: { pname = "mistral-rs"; - version = "0.9.4"; + version = "0.9.5"; __structuredAttrs = true; src = fetchFromGitHub { owner = "EricLBuehler"; repo = "mistral.rs"; tag = "v${finalAttrs.version}"; - hash = "sha256-/40obacG8jIx6BOQ8uUTiT503jRDnHrlrw5PGoEfbEM="; + hash = "sha256-3NZGfKyznzb80diu3Va2GwvQKQeQxypJ5JoGyzeA9ak="; }; patches = [ @@ -130,7 +130,7 @@ rustPlatform.buildRustPackage (finalAttrs: { "" ''; - cargoHash = "sha256-56Z1ea/5x8fE055lvi7kfFQTyNTH49+bnotn0XCRwpU="; + cargoHash = "sha256-qqFkO5BJ7mhWuLsCDte9BqCVjaqbePp+lY4BqhYYcUQ="; nativeBuildInputs = [ pkg-config No auto update branch exists Old version 0.9.4" not present in master derivation file with contents: { lib, stdenv, rustPlatform, fetchFromGitHub, # nativeBuildInputs pkg-config, python3, autoPatchelfHook, autoAddDriverRunpath, # buildInputs oniguruma, openssl, mkl, # env fetchurl, versionCheckHook, mistral-rs, nix-update-script, cudaPackages, cudaCapability ? null, config, # one of `[ null false "cuda" "mkl" "metal" ]` acceleration ? null, }: let inherit (stdenv) hostPlatform; rustc = rustPlatform.callPackage ({ rustc }: rustc) { }; accelIsValid = builtins.elem acceleration [ null false "cuda" "mkl" "metal" ]; cudaSupport = assert accelIsValid; (acceleration == "cuda") || (config.cudaSupport && acceleration == null); minRequiredCudaCapability = "8.0"; # build fails with 7.5 inherit (cudaPackages.flags) cudaCapabilities; cudaCapabilityString = if cudaCapability == null then (builtins.head ( (builtins.filter (cap: lib.versionAtLeast cap minRequiredCudaCapability) cudaCapabilities) ++ [ (lib.warn "mistral-rs doesn't support ${lib.concatStringsSep " " cudaCapabilities}" minRequiredCudaCapability) ] )) else cudaCapability; cudaCapability' = lib.toInt (cudaPackages.flags.dropDots cudaCapabilityString); mklSupport = assert accelIsValid; (acceleration == "mkl"); metalSupport = assert accelIsValid; (acceleration == "metal") || (hostPlatform.isDarwin && hostPlatform.isAarch64 && (acceleration == null)); in rustPlatform.buildRustPackage (finalAttrs: { pname = "mistral-rs"; version = "0.9.5"; __structuredAttrs = true; src = fetchFromGitHub { owner = "EricLBuehler"; repo = "mistral.rs"; tag = "v${finalAttrs.version}"; hash = "sha256-3NZGfKyznzb80diu3Va2GwvQKQeQxypJ5JoGyzeA9ak="; }; patches = [ ./no-native-cpu.patch ]; postPatch = # LTO significantly increases the build time (12m -> 1h) '' substituteInPlace Cargo.toml \ --replace-fail \ "lto = true" \ "lto = false" '' # LLVM 21 cannot select the VPDPBUSD intrinsic because its argument types are incorrect. # Fixed by https://github.com/rust-lang/llvm-project/commit/94e2c19f86a699d7a19ff0f4130b696699189c8d. + lib.optionalString (hostPlatform.isx86_64 && lib.versionOlder rustc.llvm.version "22") '' substituteInPlace "$cargoDepsCopy/source-git-0/candle-core-0.11.0/src/quantized/mod.rs" \ --replace-fail \ '#[cfg(target_arch = "x86_64")]' \ '#[cfg(any())]' \ --replace-fail \ '#[cfg(not(any(target_arch = "aarch64", target_arch = "x86_64")))]' \ '#[cfg(not(target_arch = "aarch64"))]' substituteInPlace "$cargoDepsCopy/source-git-0/candle-core-0.11.0/src/quantized/repack.rs" \ --replace-fail \ '#[cfg(target_arch = "x86_64")]' \ '#[cfg(any())]' \ --replace-fail \ '#[cfg(not(any(target_arch = "aarch64", target_arch = "x86_64")))]' \ '#[cfg(not(target_arch = "aarch64"))]' '' # Prevent build scripts from attempting to clone cutlass (which would fail in the sandbox anyway). # Instead, we provide cutlass in buildInputs. + lib.optionalString cudaSupport '' substituteInPlace mistralrs-flash-attn/build.rs \ --replace-fail \ ".with_cutlass(Some(&cutlass_commit))" \ "" substituteInPlace mistralrs-quant/build.rs \ --replace-fail \ "builder = builder.with_cutlass(Some(&cutlass_commit));" \ "" ''; cargoHash = "sha256-qqFkO5BJ7mhWuLsCDte9BqCVjaqbePp+lY4BqhYYcUQ="; nativeBuildInputs = [ pkg-config python3 ] ++ lib.optionals cudaSupport [ # WARNING: autoAddDriverRunpath must run AFTER autoPatchelfHook # Otherwise, autoPatchelfHook removes driverLink from RUNPATH autoPatchelfHook autoAddDriverRunpath cudaPackages.cuda_nvcc ]; buildInputs = [ oniguruma openssl ] ++ lib.optionals cudaSupport [ cudaPackages.cccl cudaPackages.cuda_cudart cudaPackages.cuda_nvrtc cudaPackages.libcublas cudaPackages.libcurand # For compiling kernels cudaPackages.cutlass ] ++ lib.optionals mklSupport [ mkl ]; buildFeatures = lib.optionals cudaSupport [ "cuda" ] ++ lib.optionals mklSupport [ "mkl" ] ++ lib.optionals (hostPlatform.isDarwin && metalSupport) [ "metal" ]; env = { # metal (proprietary) is not available in the darwin sandbox. # Hence, we must disable metal precompilation. MISTRALRS_METAL_PRECOMPILE = 0; SWAGGER_UI_DOWNLOAD_URL = let # When updating: # - Look for the version of `utoipa-swagger-ui` at: # https://github.com/EricLBuehler/mistral.rs/blob/v/Cargo.toml # - Look at the corresponding version of `swagger-ui` at: # https://github.com/juhaku/utoipa/blob/utoipa-swagger-ui-/utoipa-swagger-ui/build.rs#L21-L22 swaggerUiVersion = "5.17.14"; swaggerUi = fetchurl { url = "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${swaggerUiVersion}.zip"; hash = "sha256-SBJE0IEgl7Efuu73n3HZQrFxYX+cn5UU5jrL4T5xzNw="; }; in "file://${swaggerUi}"; RUSTONIG_SYSTEM_LIBONIG = true; } // (lib.optionalAttrs cudaSupport { CUDA_COMPUTE_CAP = cudaCapability'; # We already list CUDA dependencies in buildInputs # We only set CUDA_TOOLKIT_ROOT_DIR to satisfy some redundant checks from upstream CUDA_TOOLKIT_ROOT_DIR = lib.getDev cudaPackages.cuda_cudart; }); appendRunpaths = lib.optionals cudaSupport [ (lib.makeLibraryPath [ cudaPackages.libcublas cudaPackages.libcurand ]) ]; # swagger-ui will once more be copied in the target directory during the check phase # See https://github.com/juhaku/utoipa/blob/utoipa-swagger-ui-9.0.2/utoipa-swagger-ui/build.rs#L168 # Not deleting the existing unpacked archive leads to a `PermissionDenied` error preCheck = '' rm -rf target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/build/ ''; # Prevent checkFeatures from inheriting buildFeatures because # - `cargo check ... --features=cuda` requires access to a real GPU # - `cargo check ... --features=metal` (on darwin) requires the sandbox to be completely disabled checkFeatures = [ ]; checkFlags = [ # Error: failed to read MTP model config: No such file or directory (os error 2) "--skip=external_mtp_checkpoint_bytes_are_added_to_the_cache_reservation" # Max error 0.27852345 is too large "--skip=vector_fp8::ops::tests::test_fp8_vector_quant_cpu" # Try to access internet "--skip=gguf::gguf_tokenizer::tests::test_encode_decode_gpt2" "--skip=gguf::gguf_tokenizer::tests::test_encode_decode_llama" "--skip=util::tests::test_parse_image_url" "--skip=utils::tiktoken::tests::test_tiktoken_conversion" # Spawn a nested sandbox (bubblewrap-like) which fails inside the nix build sandbox "--skip=callbacks_outlive_manager_executor_tempdir" "--skip=sandboxed_session_can_execute_python" "--skip=sandboxed_session_default_policy_can_execute_python" # Linux namespace / seccomp tests require capabilities the nix build sandbox blocks "--skip=network_none_blocks_socket" "--skip=rlimit_nproc_caps_processes" "--skip=seccomp_blocks_ptrace" "--skip=unshare_is_denied_inside_child" # Timing-sensitive (relies on a 30ms sleep), flaky under load "--skip=isq_executor::tests::executor_waits_for_budget_release" ] ++ lib.optionals hostPlatform.isDarwin [ # system-configuration panics in the sandbox: "Attempted to create a NULL object." "--skip=search::tests::search_tools_refuse_internal_urls" ]; nativeInstallCheckInputs = [ versionCheckHook ]; # When started, mistralrs tries to load libcuda.so from the driver which is not available in the sandbox # mistralrs: error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory doInstallCheck = !cudaSupport; __darwinAllowLocalNetworking = true; passthru = { tests = { withMkl = lib.optionalAttrs (hostPlatform.isLinux && hostPlatform.isx86_64) ( mistral-rs.override { acceleration = "mkl"; } ); withCuda = lib.optionalAttrs hostPlatform.isLinux (mistral-rs.override { acceleration = "cuda"; }); withMetal = lib.optionalAttrs (hostPlatform.isDarwin && hostPlatform.isAarch64) ( mistral-rs.override { acceleration = "metal"; } ); }; updateScript = nix-update-script { }; }; meta = { description = "Blazingly fast LLM inference"; homepage = "https://github.com/EricLBuehler/mistral.rs"; changelog = "https://github.com/EricLBuehler/mistral.rs/releases/tag/v${finalAttrs.version}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ GaetanLepage ]; mainProgram = "mistralrs"; platforms = if cudaSupport then lib.platforms.linux else if metalSupport then [ "aarch64-darwin" ] else if mklSupport then [ "x86_64-linux" ] else lib.platforms.unix; problems = lib.optionalAttrs mklSupport { broken-mkl-support = { kind = "broken"; message = "mistral-rs' MKL support is currently broken."; }; }; }; })