nixpkgs/pkgs/by-name/uv/uv/package.nix
2024-06-11 14:07:55 +00:00

88 lines
1.9 KiB
Nix

{ lib
, cmake
, darwin
, fetchFromGitHub
, installShellFiles
, libiconv
, openssl
, pkg-config
, python3Packages
, rustPlatform
, stdenv
, testers
, uv
, nix-update-script
}:
python3Packages.buildPythonApplication rec {
pname = "uv";
version = "0.2.10";
pyproject = true;
src = fetchFromGitHub {
owner = "astral-sh";
repo = "uv";
rev = "refs/tags/${version}";
hash = "sha256-xVddhsCGJcESZhkZnu6tcwwifT9+MQz53qV00B9oHA0=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"async_zip-0.0.17" = "sha256-Q5fMDJrQtob54CTII3+SXHeozy5S5s3iLOzntevdGOs=";
"pubgrub-0.2.1" = "sha256-i1Eaip4J5VXb66p1w0sRjP655AngBLEym70ChbAFFIc=";
};
};
nativeBuildInputs = [
cmake
installShellFiles
pkg-config
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
buildInputs = [
libiconv
openssl
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
dontUseCmakeConfigure = true;
cargoBuildFlags = [ "--package" "uv" ];
env = {
OPENSSL_NO_VENDOR = true;
};
postInstall = ''
export HOME=$TMPDIR
installShellCompletion --cmd uv \
--bash <($out/bin/uv --generate-shell-completion bash) \
--fish <($out/bin/uv --generate-shell-completion fish) \
--zsh <($out/bin/uv --generate-shell-completion zsh)
'';
pythonImportsCheck = [
"uv"
];
passthru = {
tests.version = testers.testVersion {
package = uv;
};
updateScript = nix-update-script { };
};
meta = {
description = "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 lib.licenses; [ asl20 mit ];
maintainers = with lib.maintainers; [ GaetanLepage ];
mainProgram = "uv";
};
}