nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5}:
6
7stdenv.mkDerivation (finalAttrs: {
8 pname = "pkcrack";
9 version = "1.2.3";
10
11 src = fetchurl {
12 url = "https://www.unix-ag.uni-kl.de/~conrad/krypto/pkcrack/pkcrack-${finalAttrs.version}.tar.gz";
13 hash = "sha256-j0n6OHlio3oUyavVSQFnIaY0JREFv0uDfMcvC61BPTg=";
14 };
15 sourceRoot = "pkcrack-${finalAttrs.version}/src";
16
17 postPatch = ''
18 # malloc.h is not needed because stdlib.h is already included.
19 # On macOS, malloc.h does not even exist, resulting in an error.
20 substituteInPlace exfunc.c extract.c main.c readhead.c zipdecrypt.c \
21 --replace '#include <malloc.h>' ""
22 '';
23
24 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
25 enableParallelBuilding = true;
26
27 installPhase = ''
28 runHook preInstall
29
30 install -D extract $out/bin/extract
31 install -D findkey $out/bin/findkey
32 install -D makekey $out/bin/makekey
33 install -D pkcrack $out/bin/pkcrack
34 install -D zipdecrypt $out/bin/zipdecrypt
35
36 mkdir -p $out/share/doc
37 cp -R ../doc/ $out/share/doc/pkcrack
38
39 runHook postInstall
40 '';
41
42 meta = {
43 description = "Breaking PkZip-encryption";
44 homepage = "https://www.unix-ag.uni-kl.de/~conrad/krypto/pkcrack.html";
45 license = {
46 fullName = "PkCrack Non Commercial License";
47 url = "https://www.unix-ag.uni-kl.de/~conrad/krypto/pkcrack/pkcrack-readme.html";
48 free = false;
49 };
50 maintainers = with lib.maintainers; [ emilytrau ];
51 platforms = lib.platforms.all;
52 mainProgram = "pkcrack";
53 };
54})