nixpkgs/pkgs/tools/security/hashcat/default.nix
Arthur Gautier ab8e2e46d9
hashcat: fixup opencl support (#121961)
This fixes the following compilation error:
```
clBuildProgram(): CL_BUILD_PROGRAM_FAILURE

/run/user/1000/comgr-64ff7f/input/CompileSource:2252:18: fatal error:
cannot open file
'/run/user/1000/comgr-64ff7f/input/inc_comp_multi_bs.cl': No such file
or directory
        #include COMPARE_M
                 ^
/run/user/1000/comgr-64ff7f/input/CompileSource:16:19: note: expanded
from macro 'COMPARE_M'
                  ^
1 error generated.
Error: Failed to compile opencl source (from CL or HIP source to LLVM
IR).
```

Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
2021-05-11 14:01:35 +02:00

49 lines
1.2 KiB
Nix

{ lib, stdenv
, fetchurl
, makeWrapper
, opencl-headers
, ocl-icd
, xxHash
}:
stdenv.mkDerivation rec {
pname = "hashcat";
version = "6.1.1";
src = fetchurl {
url = "https://hashcat.net/files/hashcat-${version}.tar.gz";
sha256 = "104z63m7lqbb0sdrxhf9yi15l4a9zwf9m6zs9dbb3gf0nfxl1h9r";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ opencl-headers xxHash ];
makeFlags = [
"PREFIX=${placeholder "out"}"
"COMPTIME=1337"
"VERSION_TAG=${version}"
"USE_SYSTEM_OPENCL=1"
"USE_SYSTEM_XXHASH=1"
];
preFixup = ''
for f in $out/share/hashcat/OpenCL/*.cl; do
# Rewrite files to be included for compilation at runtime for opencl offload
sed "s|#include \"\(.*\)\"|#include \"$out/share/hashcat/OpenCL/\1\"|g" -i "$f"
sed "s|#define COMPARE_\([SM]\) \"\(.*\.cl\)\"|#define COMPARE_\1 \"$out/share/hashcat/OpenCL/\2\"|g" -i "$f"
done
'';
postFixup = ''
wrapProgram $out/bin/hashcat --prefix LD_LIBRARY_PATH : ${ocl-icd}/lib
'';
meta = with lib; {
description = "Fast password cracker";
homepage = "https://hashcat.net/hashcat/";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ kierdavis zimbatm ];
};
}