1{
2 buildPythonPackage,
3 ruff,
4 rustPlatform,
5 installShellFiles,
6}:
7
8buildPythonPackage {
9 inherit (ruff)
10 pname
11 version
12 src
13 cargoDeps
14 postInstall
15 meta
16 ;
17
18 # Do not rely on path lookup at runtime to find the ruff binary
19 postPatch = ''
20 substituteInPlace python/ruff/__main__.py \
21 --replace-fail \
22 'ruff_exe = "ruff" + sysconfig.get_config_var("EXE")' \
23 'return "${placeholder "out"}/bin/ruff"'
24 '';
25
26 pyproject = true;
27
28 nativeBuildInputs = [
29 installShellFiles
30 rustPlatform.cargoSetupHook
31 rustPlatform.maturinBuildHook
32 ];
33
34 pythonImportsCheck = [ "ruff" ];
35}