From 7b45cb769749092878652ad5b1aa2958d441f28b Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 1 Mar 2023 16:58:56 +0100 Subject: [PATCH] Added sherlock --- home/adrielus/tethys.nix | 10 +++++--- pkgs/default.nix | 1 + pkgs/sherlock.nix | 51 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 pkgs/sherlock.nix diff --git a/home/adrielus/tethys.nix b/home/adrielus/tethys.nix index 0f5f48c..df60557 100644 --- a/home/adrielus/tethys.nix +++ b/home/adrielus/tethys.nix @@ -7,7 +7,9 @@ ./features/desktop/common/firefox.nix ]; + # Arbitrary extra packages home.packages = with pkgs; [ + # Desktop apps signal-desktop # Signal client zoom-us # Zoom client 🤮 obsidian # Notes @@ -15,10 +17,12 @@ vlc # Video player gimp # Image editing libreoffice # Free office suite - lmms # music software - agenix # secret encryption - + lmms # Music software # obs-studio # video recorder + + # Clis + agenix # Secret encryption + sherlock # Search for usernames across different websites ]; home.sessionVariables.QT_SCREEN_SCALE_FACTOR = 1.4; # Bigger text in qt apps diff --git a/pkgs/default.nix b/pkgs/default.nix index 4ddc912..44074d3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,6 +4,7 @@ { pkgs ? (import ../nixpkgs.nix) { } }: { # example = pkgs.callPackage (import ./example.nix) {}; vimclip = pkgs.callPackage (import ./vimclip.nix) {}; + sherlock = pkgs.callPackage (import ./sherlock.nix) {}; plymouthThemes = pkgs.callPackage (import ./plymouth-themes.nix) {}; } diff --git a/pkgs/sherlock.nix b/pkgs/sherlock.nix new file mode 100644 index 0000000..9dce3ba --- /dev/null +++ b/pkgs/sherlock.nix @@ -0,0 +1,51 @@ +# Up to date version of [this](https://github.com/NixOS/nixpkgs/blob/nixos-22.11/pkgs/tools/security/sherlock/default.nix) +{ stdenv, lib, fetchFromGitHub, python3, makeWrapper }: +let + pyenv = python3.withPackages (pp: with pp; [ + beautifulsoup4 + certifi + colorama + lxml + pysocks + requests + requests-futures + soupsieve + stem + torrequest + pandas + ]); +in +stdenv.mkDerivation rec { + pname = "sherlock"; + version = "unstable-2023-02-27"; + + src = fetchFromGitHub { + owner = "sherlock-project"; + repo = "sherlock"; + rev = "61bb34b0213482164247df496a063b9e41b98f78"; + sha256 = "0lnwph8vvxj47bx3dys4f2g4zixp791xhhijwa4y81rihlr0q89l"; + }; + + nativeBuildInputs = [ makeWrapper ]; + + postPatch = '' + substituteInPlace sherlock/sherlock.py \ + --replace "os.path.dirname(__file__)" "\"$out/share\"" + ''; + + 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" + runHook postInstall + ''; + + checkPhase = '' + runHook preCheck + cd $srcRoot/sherlock + ${pyenv.interpreter} -m unittest tests.all.SherlockSiteCoverageTests --verbose + runHook postCheck + ''; +}