1{
2 stdenvNoCC,
3 lib,
4 fetchurl,
5 unzip,
6 nix-update-script,
7 versionCheckHook,
8}:
9stdenvNoCC.mkDerivation rec {
10 pname = "swiftlint";
11 version = "0.59.0";
12
13 src = fetchurl {
14 url = "https://github.com/realm/SwiftLint/releases/download/${version}/portable_swiftlint.zip";
15 hash = "sha256-rsGt9hy2EklZEA7eQ/Tp9eztVLVlVn9LMPTeZz9fQYA=";
16 };
17
18 dontPatch = true;
19 dontConfigure = true;
20 dontBuild = true;
21
22 nativeBuildInputs = [ unzip ];
23
24 sourceRoot = ".";
25
26 installPhase = ''
27 runHook preInstall
28 install -Dm755 swiftlint $out/bin/swiftlint
29 runHook postInstall
30 '';
31
32 doInstallCheck = true;
33 nativeInstallCheckInputs = [ versionCheckHook ];
34
35 passthru.updateScript = nix-update-script { };
36
37 meta = {
38 description = "Tool to enforce Swift style and conventions";
39 homepage = "https://realm.github.io/SwiftLint/";
40 license = lib.licenses.mit;
41 mainProgram = "swiftlint";
42 maintainers = with lib.maintainers; [
43 matteopacini
44 DimitarNestorov
45 ];
46 platforms = lib.platforms.darwin;
47 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
48 };
49}