1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 gitMinimal,
7 python3,
8 makeWrapper,
9 writeScriptBin,
10 versionCheckHook,
11 nix-update-script,
12 writableTmpDirAsHomeHook,
13}:
14
15rustPlatform.buildRustPackage rec {
16 pname = "pylyzer";
17 version = "0.0.82";
18
19 src = fetchFromGitHub {
20 owner = "mtshiba";
21 repo = "pylyzer";
22 tag = "v${version}";
23 hash = "sha256-cSMHd3j3xslSR/v4KZ5LUwxPPR/b+okwrT54gUyLXXw=";
24 };
25
26 cargoHash = "sha256-JrDj88JjQon2rtywa/PqnS1pTxTLigPHNnqQS/tO9RA=";
27
28 nativeBuildInputs = [
29 gitMinimal
30 python3
31 makeWrapper
32 writableTmpDirAsHomeHook
33 ]
34 ++ lib.optionals stdenv.hostPlatform.isDarwin [ (writeScriptBin "diskutil" "") ];
35
36 buildInputs = [
37 python3
38 ];
39
40 postInstall = ''
41 mkdir -p $out/lib
42 cp -r $HOME/.erg/ $out/lib/erg
43 '';
44
45 postFixup = ''
46 wrapProgram $out/bin/pylyzer --set ERG_PATH $out/lib/erg
47 '';
48
49 nativeInstallCheckInputs = [
50 versionCheckHook
51 ];
52 versionCheckProgramArg = "--version";
53 doInstallCheck = true;
54
55 passthru = {
56 updateScript = nix-update-script { };
57 };
58
59 meta = {
60 description = "Fast static code analyzer & language server for Python";
61 homepage = "https://github.com/mtshiba/pylyzer";
62 changelog = "https://github.com/mtshiba/pylyzer/releases/tag/v${version}";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ natsukium ];
65 mainProgram = "pylyzer";
66 };
67}