summary refs log tree commit diff
path: root/pkgs/tools/security/sherlock/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/security/sherlock/default.nix')
-rw-r--r--pkgs/tools/security/sherlock/default.nix70
1 files changed, 41 insertions, 29 deletions
diff --git a/pkgs/tools/security/sherlock/default.nix b/pkgs/tools/security/sherlock/default.nix
index 05954db5162..e3d6f658aea 100644
--- a/pkgs/tools/security/sherlock/default.nix
+++ b/pkgs/tools/security/sherlock/default.nix
@@ -1,50 +1,61 @@
-{ stdenv, lib, fetchFromGitHub, python3, makeWrapper }:
-let
-  pyenv = python3.withPackages (pp: with pp; [
-    beautifulsoup4
-    certifi
-    colorama
-    lxml
-    pandas
-    pysocks
-    requests
-    requests-futures
-    soupsieve
-    stem
-    torrequest
-  ]);
-in
-stdenv.mkDerivation rec {
+{ lib
+, fetchFromGitHub
+, makeWrapper
+, python3
+}:
+
+python3.pkgs.buildPythonApplication rec {
   pname = "sherlock";
-  version = "0.14.3";
+  version = "unstable-2023-10-06";
+  format = "other";
 
   src = fetchFromGitHub {
     owner = "sherlock-project";
     repo = pname;
-    rev = "ab2f6788340903df797d8c336a97fa6e742daf77";
-    hash = "sha256-AbWZa33DNrDM0FdjoFSVMnz4Ph7mUiUe/erhI3w7GQQ";
+    rev = "7ec56895a37ada47edd6573249c553379254d14a";
+    hash = "sha256-bK5yEdh830vgKcsU3gLH7TybLncnX6eRIiYPUiVWM74=";
   };
 
   nativeBuildInputs = [ makeWrapper ];
 
-  postPatch = ''
-    substituteInPlace sherlock/sherlock.py \
-      --replace "os.path.dirname(__file__)" "\"$out/share\""
-  '';
+  propagatedBuildInputs = with python3.pkgs; [
+    certifi
+    colorama
+    pandas
+    pysocks
+    requests
+    requests-futures
+    stem
+    torrequest
+  ];
 
   installPhase = ''
     runHook preInstall
+
     mkdir -p $out/bin $out/share
-    cp ./sherlock/*.py $out/bin/
-    cp --recursive ./sherlock/resources/ $out/share
-    makeWrapper ${pyenv.interpreter} $out/bin/sherlock --add-flags "$out/bin/sherlock.py"
+    cp -R ./sherlock $out/share
+
     runHook postInstall
   '';
 
+  postFixup = ''
+    makeWrapper ${python3.interpreter} $out/bin/sherlock \
+      --add-flags $out/share/sherlock/sherlock.py \
+      --prefix PYTHONPATH : "$PYTHONPATH"
+  '';
+
+  checkInputs = with python3.pkgs; [
+    exrex
+  ];
+
   checkPhase = ''
     runHook preCheck
-    cd $srcRoot/sherlock
-    ${pyenv.interpreter} -m unittest tests.all.SherlockSiteCoverageTests --verbose
+
+    cd $out/share/sherlock
+    for tests in all test_multiple_usernames; do
+      ${python3.interpreter} -m unittest tests.$tests --verbose
+    done
+
     runHook postCheck
   '';
 
@@ -52,6 +63,7 @@ stdenv.mkDerivation rec {
     homepage = "https://sherlock-project.github.io/";
     description = "Hunt down social media accounts by username across social networks";
     license = licenses.mit;
+    mainProgram = "sherlock";
     maintainers = with maintainers; [ applePrincess ];
   };
 }