lol
at 24.05-pre 52 lines 1.5 kB view raw
1{ lib, stdenvNoCC, fetchPypi, unzip }: 2 3let 4 common = import ./common.nix { inherit lib; }; 5in 6stdenvNoCC.mkDerivation rec { 7 pname = "semgrep-core"; 8 inherit (common) version; 9 # fetch pre-built semgrep-core since the ocaml build is complex and relies on 10 # the opam package manager at some point 11 # pulling it out of the python wheel as r2c no longer release a built binary 12 # on github releases 13 src = 14 let 15 inherit (stdenvNoCC.hostPlatform) system; 16 data = common.core.${system} or (throw "Unsupported system: ${system}"); 17 in 18 fetchPypi rec { 19 pname = "semgrep"; 20 inherit version; 21 format = "wheel"; 22 dist = python; 23 python = "cp37.cp38.cp39.cp310.cp311.py37.py38.py39.py310.py311"; 24 inherit (data) platform hash; 25 }; 26 27 nativeBuildInputs = [ unzip ]; 28 29 # _tryUnzip from unzip's setup-hook doesn't recognise .whl 30 # "do not know how to unpack source archive" 31 # perform unpack by hand 32 unpackPhase = '' 33 runHook preUnpack 34 LANG=en_US.UTF-8 unzip -qq "$src" 35 runHook postUnpack 36 ''; 37 38 dontConfigure = true; 39 dontBuild = true; 40 41 installPhase = '' 42 runHook preInstall 43 install -Dm 755 -t $out/bin semgrep-${version}.data/purelib/semgrep/bin/semgrep-core 44 runHook postInstall 45 ''; 46 47 meta = common.meta // { 48 description = common.meta.description + " - core binary"; 49 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 50 platforms = lib.attrNames common.core; 51 }; 52}