ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / ma / masscan / package.nix
blob9606fe0f1156ee16c755b40fc010d996dcd5feef
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , installShellFiles
6 , makeWrapper
7 , libpcap
8 }:
10 stdenv.mkDerivation rec {
11   pname = "masscan";
12   version = "1.3.2";
14   src = fetchFromGitHub {
15     owner = "robertdavidgraham";
16     repo = "masscan";
17     rev = version;
18     sha256 = "sha256-mnGC/moQANloR5ODwRjzJzBa55OEZ9QU+9WpAHxQE/g=";
19   };
21   patches = [
22     # Patches the missing "--resume" functionality
23     (fetchpatch {
24       name = "resume.patch";
25       url = "https://github.com/robertdavidgraham/masscan/commit/90791550bbdfac8905917a109ed74024161f14b3.patch";
26       sha256 = "sha256-A7Fk3MBNxaad69MrUYg7fdMG77wba5iESDTIRigYslw=";
27     })
28   ];
30   postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
31     # Fix broken install command
32     substituteInPlace Makefile --replace "-pm755" "-pDm755"
33   '';
35   nativeBuildInputs = [ makeWrapper installShellFiles ];
37   makeFlags = [
38     "PREFIX=$(out)"
39     "GITVER=${version}"
40     "CC=${stdenv.cc.targetPrefix}cc"
41   ];
43   enableParallelBuilding = true;
45   postInstall = ''
46     installManPage doc/masscan.?
48     install -Dm444 -t $out/etc/masscan            data/exclude.conf
49     install -Dm444 -t $out/share/doc/masscan      doc/*.{html,js,md}
50     install -Dm444 -t $out/share/licenses/masscan LICENSE
52     wrapProgram $out/bin/masscan \
53       --prefix LD_LIBRARY_PATH : "${libpcap}/lib"
54   '';
56   doInstallCheck = true;
58   installCheckPhase = ''
59     $out/bin/masscan --selftest
60   '';
62   meta = with lib; {
63     description = "Fast scan of the Internet";
64     mainProgram = "masscan";
65     homepage = "https://github.com/robertdavidgraham/masscan";
66     changelog = "https://github.com/robertdavidgraham/masscan/releases/tag/${version}";
67     license = licenses.agpl3Only;
68     platforms = platforms.unix;
69     maintainers = with maintainers; [ rnhmjoj ];
70   };