about summary refs log tree commit diff
path: root/pkgs/tools/security/semgrep/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/security/semgrep/default.nix')
-rw-r--r--pkgs/tools/security/semgrep/default.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/tools/security/semgrep/default.nix b/pkgs/tools/security/semgrep/default.nix
index 0e9c3ddc391c..23749643a443 100644
--- a/pkgs/tools/security/semgrep/default.nix
+++ b/pkgs/tools/security/semgrep/default.nix
@@ -1,6 +1,5 @@
 { lib
 , fetchFromGitHub
-, callPackage
 , semgrep-core
 , buildPythonApplication
 , pythonPackages
@@ -11,12 +10,20 @@
 }:
 
 let
-  common = callPackage ./common.nix { };
+  common = import ./common.nix { inherit lib; };
 in
 buildPythonApplication rec {
   pname = "semgrep";
-  inherit (common) src version;
+  inherit (common) version;
+  src = fetchFromGitHub {
+    owner = "returntocorp";
+    repo = "semgrep";
+    rev = "v${version}";
+    hash = common.srcHash;
+  };
 
+  # prepare a subset of the submodules as we only need a handful
+  # and there are many many submodules total
   postPatch = (lib.concatStringsSep "\n" (lib.mapAttrsToList
     (
       path: submodule: ''
@@ -27,7 +34,7 @@ buildPythonApplication rec {
         ln -s ${submodule}/ ${path}
       ''
     )
-    common.submodules)) + ''
+    passthru.submodulesSubset)) + ''
     cd cli
   '';
 
@@ -97,10 +104,12 @@ buildPythonApplication rec {
 
   passthru = {
     inherit common;
+    submodulesSubset = lib.mapAttrs (k: args: fetchFromGitHub args) common.submodules;
     updateScript = ./update.sh;
   };
 
   meta = common.meta // {
     description = common.meta.description + " - cli";
+    inherit (semgrep-core.meta) platforms;
   };
 }