nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchurl,
4 fetchFromGitHub,
5 php,
6 versionCheckHook,
7 runCommand,
8}:
9
10let
11 version = "6.14.3";
12
13 # The PHAR file is only required to get the `composer.lock` file
14 psalm-phar = fetchurl {
15 url = "https://github.com/vimeo/psalm/releases/download/${version}/psalm.phar";
16 hash = "sha256-dqRI73CdY51K1aitIK6R74Y2sLb68l4ndNuTzRv8qRE=";
17 };
18in
19php.buildComposerProject2 (finalAttrs: {
20 pname = "psalm";
21 inherit version;
22
23 src = fetchFromGitHub {
24 owner = "vimeo";
25 repo = "psalm";
26 tag = finalAttrs.version;
27 hash = "sha256-6MO16Ch3SR2kn48lTj64c/1DZDpsLjpZcFYmtiBhCCU=";
28 };
29
30 composerLock = runCommand "composer.lock" { } ''
31 ${lib.getExe php} -r '$phar = new Phar("${psalm-phar}"); $phar->extractTo(".", "composer.lock");'
32 cp composer.lock $out
33 '';
34 vendorHash = "sha256-2LlP0D7b07yXVGc/+pJUUWYXF8rsc4HiErBUt5SfZmw=";
35
36 doInstallCheck = true;
37 nativeInstallCheckInputs = [ versionCheckHook ];
38
39 meta = {
40 changelog = "https://github.com/vimeo/psalm/releases/tag/${finalAttrs.version}";
41 description = "Static analysis tool for finding errors in PHP applications";
42 homepage = "https://github.com/vimeo/psalm";
43 license = lib.licenses.mit;
44 mainProgram = "psalm";
45 maintainers = [ lib.maintainers.patka ];
46 };
47})