1 { lib, fetchFromGitHub, fetchzip, stdenv }:
6 src = fetchFromGitHub {
7 owner = "returntocorp";
10 sha256 = "sha256-SZtxZz4x6YUKw1uO5HQTU4lRY989SoCNsPQphJr+L0Y=";
13 # submodule dependencies
14 # these are fetched so we:
15 # 1. don't fetch the many submodules we don't need
16 # 2. avoid fetchSubmodules since it's prone to impurities
17 langsSrc = fetchFromGitHub {
18 owner = "returntocorp";
19 repo = "semgrep-langs";
20 rev = "91e288062eb794e8a5e6967d1009624237793491";
21 sha256 = "sha256-z2t2bTRyj5zu9h/GBg2YeRFimpJsd3dA7dK8VBaKzHo=";
24 interfacesSrc = fetchFromGitHub {
25 owner = "returntocorp";
26 repo = "semgrep-interfaces";
27 rev = "7bc457a32e088ef21adf1529fa0ddeea634b9131";
28 sha256 = "sha256-xN8Qm1/YLa49k9fZKDoPPmHASI2ipI3mkKlwEK2ajO4=";
31 # fetch pre-built semgrep-core since the ocaml build is complex and relies on
32 # the opam package manager at some point
33 coreRelease = if stdenv.isDarwin then fetchzip {
34 url = "https://github.com/returntocorp/semgrep/releases/download/v${version}/semgrep-v${version}-osx.zip";
35 sha256 = "sha256-JiOH39vMDL6r9WKuPO0CDkRwGZtzl/GIFoSegVddFpw=";
37 url = "https://github.com/returntocorp/semgrep/releases/download/v${version}/semgrep-v${version}-ubuntu-16.04.tgz";
38 sha256 = "sha256-V6r+VQrgz8uVSbRa2AmW4lnLxovk63FL7LqVKD46RBw=";
42 homepage = "https://semgrep.dev/";
43 downloadPage = "https://github.com/returntocorp/semgrep/";
44 changelog = "https://github.com/returntocorp/semgrep/blob/v${version}/CHANGELOG.md";
45 description = "Lightweight static analysis for many languages";
47 Semgrep is a fast, open-source, static analysis tool for finding bugs and
48 enforcing code standards at editor, commit, and CI time. Semgrep analyzes
49 code locally on your computer or in your build environment: code is never
50 uploaded. Its rules look like the code you already write; no abstract
51 syntax trees, regex wrestling, or painful DSLs.
53 license = licenses.lgpl21Plus;
54 maintainers = with maintainers; [ jk ambroisie ];
55 # limited by semgrep-core
56 platforms = [ "x86_64-linux" "x86_64-darwin" ];