Files
mistralrs-package/rpm/mistralrs.spec
rob thijssen b6977eda02
All checks were successful
poll-upstream / check (push) Successful in 1s
feat(rpm): create mistralrs system user and group on install
Add %pre scriptlet to ensure the mistralrs user and group exist
before the package files are installed. The systemd unit runs the
service as this user.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 18:21:18 +03:00

80 lines
2.5 KiB
RPMSpec

%global _build_id_links none
%global debug_package %{nil}
%global __strip /usr/bin/true
# Passed in via --define at rpmbuild time
%{!?mistralrs_version: %global mistralrs_version 0.7.0}
%{!?mistralrs_flavour: %global mistralrs_flavour cuda13}
Name: mistralrs-server-%{mistralrs_flavour}
Version: %{mistralrs_version}
Release: 1%{?dist}
Summary: Fast, flexible LLM inference server (mistral.rs, %{mistralrs_flavour} flavour)
License: MIT
URL: https://github.com/EricLBuehler/mistral.rs
# Pre-built binary (produced in the build job, not rebuilt here)
Source0: mistralrs-server-%{mistralrs_flavour}
Source1: mistralrs@.service
Source2: mistralrs@.conf.example
ExclusiveArch: x86_64
# Suppress auto-detected CUDA library dependencies. The binary links against
# the CUDA runtime, cuDNN, NCCL, etc. but we don't want rpm to pin exact
# soname versions — consumers may have CUDA from multiple sources (nvidia
# direct, rpmfusion, etc.) and different compatible versions. A runtime
# dlopen failure gives a clearer error than rpm dep resolution would.
%global __requires_exclude ^lib(cuda|cudart|cudnn|cublas|cublasLt|curand|nvrtc|nccl)
Requires: systemd
Provides: mistralrs-server = %{version}-%{release}
%description
mistral.rs is a blazingly fast LLM inference engine written in Rust.
This package provides the %{mistralrs_flavour} flavour, built with features:
cuda, cudnn, and optionally flash-attn and nccl depending on flavour name.
%prep
cp %{SOURCE0} .
cp %{SOURCE1} .
cp %{SOURCE2} .
%build
# Already built
%install
install -D -m 0755 mistralrs-server-%{mistralrs_flavour} \
%{buildroot}%{_bindir}/mistralrs-server
install -D -m 0644 mistralrs@.service \
%{buildroot}%{_unitdir}/mistralrs@.service
install -D -m 0644 mistralrs@.conf.example \
%{buildroot}%{_sysconfdir}/mistralrs/default.conf.example
# Patch the unit to point at the binary
sed -i "s|@BINARY@|%{_bindir}/mistralrs-server|g" \
%{buildroot}%{_unitdir}/mistralrs@.service
sed -i "s|@FLAVOUR@|%{mistralrs_flavour}|g" \
%{buildroot}%{_unitdir}/mistralrs@.service
%pre
getent group mistralrs >/dev/null || groupadd -r mistralrs
getent passwd mistralrs >/dev/null || useradd -r -g mistralrs -d /var/lib/mistralrs -s /sbin/nologin mistralrs
%post
%systemd_post mistralrs@.service
%preun
%systemd_preun mistralrs@.service
%postun
%systemd_postun_with_restart mistralrs@.service
%files
%{_bindir}/mistralrs-server
%{_unitdir}/mistralrs@.service
%{_sysconfdir}/mistralrs/default.conf.example
%changelog