summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorJanik <80165193+Janik-Haag@users.noreply.github.com>2023-11-17 22:27:14 +0100
committerGitHub <noreply@github.com>2023-11-17 22:27:14 +0100
commitde20681ff7cb84daea4d85630a6a59f2eacf265e (patch)
treee6d3e444dfe47319e6798279dee7f84d2e7b409e /pkgs/by-name
parent8b7e94d34464fcf448d7e57ca5f5a4874fcde80d (diff)
parent198106a3d78ceae9d097bbcd0aceb4852e839e15 (diff)
downloadnixpkgs-de20681ff7cb84daea4d85630a6a59f2eacf265e.tar
nixpkgs-de20681ff7cb84daea4d85630a6a59f2eacf265e.tar.gz
nixpkgs-de20681ff7cb84daea4d85630a6a59f2eacf265e.tar.bz2
nixpkgs-de20681ff7cb84daea4d85630a6a59f2eacf265e.tar.lz
nixpkgs-de20681ff7cb84daea4d85630a6a59f2eacf265e.tar.xz
nixpkgs-de20681ff7cb84daea4d85630a6a59f2eacf265e.tar.zst
nixpkgs-de20681ff7cb84daea4d85630a6a59f2eacf265e.zip
Merge pull request #267555 from h7x4/pkgs-refactor-wordlists
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/wo/wordlists/package.nix57
1 files changed, 30 insertions, 27 deletions
diff --git a/pkgs/by-name/wo/wordlists/package.nix b/pkgs/by-name/wo/wordlists/package.nix
index 16106707fd9..5edd1f5ece4 100644
--- a/pkgs/by-name/wo/wordlists/package.nix
+++ b/pkgs/by-name/wo/wordlists/package.nix
@@ -1,11 +1,8 @@
 { lib
-, callPackage
+, symlinkJoin
 , nmap
 , rockyou
-, runtimeShell
 , seclists
-, symlinkJoin
-, tree
 , wfuzz
 , lists ? [
     nmap
@@ -13,33 +10,39 @@
     seclists
     wfuzz
   ]
+, writeShellScriptBin
+, tree
 }:
+let
+  wordlistsCollection = symlinkJoin {
+    name = "wordlists-collection";
+    paths = lists;
 
-symlinkJoin rec {
-  pname = "wordlists";
-  version = "unstable-2023-10-10";
-
-  name = "${pname}-${version}";
-  paths = lists;
+    postBuild = ''
+      shopt -s extglob
+      rm -rf $out/!(share)
+      rm -rf $out/share/!(wordlists)
+      shopt -u extglob
+    '';
+  };
 
-  postBuild = ''
-    mkdir -p $out/bin
+  # A command to show the location of the links.
+  wordlistsBin = writeShellScriptBin "wordlists" ''
+    ${lib.getExe tree} ${wordlistsCollection}/share/wordlists
+  '';
+  # A command for easy access to the wordlists.
+  wordlistsPathBin = writeShellScriptBin "wordlists_path" ''
+    printf "${wordlistsCollection}/share/wordlists\n"
+  '';
 
-    # Create a command to show the location of the links.
-    cat >> $out/bin/wordlists << __EOF__
-    #!${runtimeShell}
-    ${tree}/bin/tree ${placeholder "out"}/share/wordlists
-    __EOF__
-    chmod +x $out/bin/wordlists
+in symlinkJoin {
+  name = "wordlists";
 
-    # Create a handy command for easy access to the wordlists.
-    # e.g.: `cat "$(wordlists_path)/rockyou.txt"`, or `ls "$(wordlists_path)/dirbuster"`
-    cat >> $out/bin/wordlists_path << __EOF__
-    #!${runtimeShell}
-    printf "${placeholder "out"}/share/wordlists\n"
-    __EOF__
-    chmod +x $out/bin/wordlists_path
-  '';
+  paths = [
+    wordlistsCollection
+    wordlistsBin
+    wordlistsPathBin
+  ];
 
   meta = with lib; {
     description = "A collection of wordlists useful for security testing";
@@ -65,6 +68,6 @@ symlinkJoin rec {
       If you want to add a new package that provides wordlist/s the convention
       is to copy it to {file}`$out/share/wordlists/myNewWordlist`.
     '';
-    maintainers = with maintainers; [ janik pamplemousse ];
+    maintainers = with maintainers; [ janik pamplemousse h7x4 ];
   };
 }