nixpkgs/pkgs/development/python-modules/ruff/default.nix
2025-01-07 18:36:18 +01:00

35 lines
637 B
Nix

{
buildPythonPackage,
ruff,
rustPlatform,
installShellFiles,
}:
buildPythonPackage {
inherit (ruff)
pname
version
src
cargoDeps
postInstall
meta
;
# Do not rely on path lookup at runtime to find the ruff binary
postPatch = ''
substituteInPlace python/ruff/__main__.py \
--replace-fail \
'ruff_exe = "ruff" + sysconfig.get_config_var("EXE")' \
'return "${placeholder "out"}/bin/ruff"'
'';
pyproject = true;
nativeBuildInputs = [
installShellFiles
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
pythonImportsCheck = [ "ruff" ];
}