uv: use buildRustPackage

This commit is contained in:
Mario Rodas
2024-02-28 04:20:00 +00:00
parent 6c296a07b0
commit 1ae75bd805
+6 -17
View File
@@ -1,22 +1,16 @@
{ lib
, cargo
, cmake
, darwin
, fetchFromGitHub
, libgit2
, openssl
, pkg-config
, python3
, rustPlatform
, rustc
, stdenv
, zlib
}:
python3.pkgs.buildPythonApplication rec {
rustPlatform.buildRustPackage rec {
pname = "uv";
version = "0.1.12";
pyproject = true;
src = fetchFromGitHub {
owner = "astral-sh";
@@ -25,7 +19,7 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-tM8NX4BPGm8Xxlau+qpKSljTdSJutipsYFsZAdtmZuo=";
};
cargoDeps = rustPlatform.importCargoLock {
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"async_zip-0.0.16" = "sha256-M94ceTCtyQc1AtPXYrVGplShQhItqZZa/x5qLiL+gs0=";
@@ -34,25 +28,20 @@ python3.pkgs.buildPythonApplication rec {
};
nativeBuildInputs = [
cargo
cmake
pkg-config
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
rustc
];
buildInputs = [
libgit2
openssl
zlib
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
dontUseCmakeConfigure = true;
cargoBuildFlags = [ "--package" "uv" ];
pythonImportsCheck = [ "uv" ];
# Tests require network access
doCheck = false;
env = {
OPENSSL_NO_VENDOR = true;
@@ -61,7 +50,7 @@ python3.pkgs.buildPythonApplication rec {
meta = with lib; {
description = "An extremely fast Python package installer and resolver, written in Rust";
homepage = "https://github.com/astral-sh/uv";
changelog = "https://github.com/astral-sh/uv/releases/tag/${version}";
changelog = "https://github.com/astral-sh/uv/blob/${src.rev}/CHANGELOG.md";
license = with licenses; [ asl20 mit ];
maintainers = with maintainers; [ marsam ];
mainProgram = "uv";