about summary refs log tree commit diff
path: root/pkgs/by-name/uv/uv/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/uv/uv/package.nix')
-rw-r--r--pkgs/by-name/uv/uv/package.nix42
1 files changed, 29 insertions, 13 deletions
diff --git a/pkgs/by-name/uv/uv/package.nix b/pkgs/by-name/uv/uv/package.nix
index 77f775d3793ee..370a46da24674 100644
--- a/pkgs/by-name/uv/uv/package.nix
+++ b/pkgs/by-name/uv/uv/package.nix
@@ -3,29 +3,34 @@
 , darwin
 , fetchFromGitHub
 , installShellFiles
+, libiconv
 , openssl
 , pkg-config
+, python3Packages
 , rustPlatform
 , stdenv
+, testers
+, uv
 , nix-update-script
 }:
 
-rustPlatform.buildRustPackage rec {
+python3Packages.buildPythonApplication rec {
   pname = "uv";
-  version = "0.1.39";
+  version = "0.2.5";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "astral-sh";
     repo = "uv";
-    rev = version;
-    hash = "sha256-o5KrguapmfihO8oAse+LjBH9MvSsUORyZRALxkU4+xA=";
+    rev = "refs/tags/${version}";
+    hash = "sha256-wWTzLyN/i7nn2/b8lX+8NDk9jU/jgaygF4i+Yb7kK8c=";
   };
 
-  cargoLock = {
+  cargoDeps = rustPlatform.importCargoLock {
     lockFile = ./Cargo.lock;
     outputHashes = {
       "async_zip-0.0.17" = "sha256-Q5fMDJrQtob54CTII3+SXHeozy5S5s3iLOzntevdGOs=";
-      "pubgrub-0.2.1" = "sha256-sqC7R2mtqymYFULDW0wSbM/MKCZc8rP7Yy/gaQpjYEI=";
+      "pubgrub-0.2.1" = "sha256-mAPyo2R996ymzCt6TAX2G7xU1C3vDGjYF0z7R8lI1yg=";
     };
   };
 
@@ -33,18 +38,20 @@ rustPlatform.buildRustPackage rec {
     cmake
     installShellFiles
     pkg-config
+    rustPlatform.cargoSetupHook
+    rustPlatform.maturinBuildHook
   ];
 
   buildInputs = [
+    libiconv
     openssl
   ] ++ lib.optionals stdenv.isDarwin [
     darwin.apple_sdk.frameworks.SystemConfiguration
   ];
 
-  cargoBuildFlags = [ "--package" "uv" ];
+  dontUseCmakeConfigure = true;
 
-  # Tests require network access
-  doCheck = false;
+  cargoBuildFlags = [ "--package" "uv" ];
 
   env = {
     OPENSSL_NO_VENDOR = true;
@@ -58,14 +65,23 @@ rustPlatform.buildRustPackage rec {
       --zsh <($out/bin/uv --generate-shell-completion zsh)
   '';
 
-  passthru.updateScript = nix-update-script { };
+  pythonImportsCheck = [
+    "uv"
+  ];
+
+  passthru = {
+    tests.version = testers.testVersion {
+      package = uv;
+    };
+    updateScript = nix-update-script { };
+  };
 
-  meta = with lib; {
+  meta = {
     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/blob/${src.rev}/CHANGELOG.md";
-    license = with licenses; [ asl20 mit ];
-    maintainers = with maintainers; [ GaetanLepage ];
+    license = with lib.licenses; [ asl20 mit ];
+    maintainers = with lib.maintainers; [ GaetanLepage ];
     mainProgram = "uv";
   };
 }