nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchzip,
5
6 installShellFiles,
7 makeWrapper,
8 perl,
9 strace,
10
11 testers,
12 pvs-studio,
13}:
14
15# nixpkgs-update: no auto update
16stdenv.mkDerivation rec {
17 pname = "pvs-studio";
18 version = "7.36.91321.455";
19
20 src =
21 let
22 system = stdenv.hostPlatform.system;
23 selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
24 in
25 fetchzip {
26 url = selectSystem {
27 aarch64-darwin = "https://web.archive.org/web/20250411093324/https://files.pvs-studio.com/pvs-studio-${version}-macos-arm64.tgz";
28 x86_64-darwin = "https://web.archive.org/web/20250411092440/https://files.pvs-studio.com/pvs-studio-${version}-macos-x86_64.tgz";
29 x86_64-linux = "https://web.archive.org/web/20250411091929/https://files.pvs-studio.com/pvs-studio-${version}-x86_64.tgz";
30 };
31 hash = selectSystem {
32 aarch64-darwin = "sha256-KEDKsWXg+CRwsEi7hNKlC3CWldBtvf9Jw79vuLMKSOE=";
33 x86_64-darwin = "sha256-Esf+pohienMAkWs1q5fYZ+0RzzK/WxOGljRXYJ0AtFI=";
34 x86_64-linux = "sha256-Be4IGFA+307zuMnhXBZko6T27TYeBZHX/zxaXBWVPHo=";
35 };
36 };
37
38 nativeBuildInputs = [
39 installShellFiles
40 makeWrapper
41 ];
42
43 nativeRuntimeInputs = lib.makeBinPath (
44 [
45 perl
46 ]
47 ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform strace) [
48 strace
49 ]
50 );
51
52 installPhase = ''
53 runHook preInstall
54
55 install -D -m 0755 bin/* -t $out/bin
56 installShellCompletion --bash etc/bash_completion.d/*
57
58 runHook postInstall
59 '';
60
61 postFixup = ''
62 wrapProgram "$out/bin/pvs-studio-analyzer" \
63 --prefix PATH ":" ${nativeRuntimeInputs}
64 '';
65
66 passthru = {
67 tests.version = testers.testVersion { package = pvs-studio; };
68 };
69
70 meta = {
71 description = "Static analyzer for C and C++";
72 homepage = "https://pvs-studio.com/en/pvs-studio";
73 license = lib.licenses.unfreeRedistributable;
74 platforms = [
75 "aarch64-darwin"
76 "x86_64-darwin"
77 "x86_64-linux"
78 ];
79 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
80 maintainers = with lib.maintainers; [ ];
81 };
82}