mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 02:42:59 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
72 lines
1.8 KiB
Nix
72 lines
1.8 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, installShellFiles
|
|
, makeWrapper
|
|
, libpcap
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "masscan";
|
|
version = "1.3.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "robertdavidgraham";
|
|
repo = "masscan";
|
|
rev = version;
|
|
sha256 = "sha256-mnGC/moQANloR5ODwRjzJzBa55OEZ9QU+9WpAHxQE/g=";
|
|
};
|
|
|
|
patches = [
|
|
# Patches the missing "--resume" functionality
|
|
(fetchpatch {
|
|
name = "resume.patch";
|
|
url = "https://github.com/robertdavidgraham/masscan/commit/90791550bbdfac8905917a109ed74024161f14b3.patch";
|
|
sha256 = "sha256-A7Fk3MBNxaad69MrUYg7fdMG77wba5iESDTIRigYslw=";
|
|
})
|
|
];
|
|
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
# Fix broken install command
|
|
substituteInPlace Makefile --replace "-pm755" "-pDm755"
|
|
'';
|
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
|
|
|
makeFlags = [
|
|
"PREFIX=$(out)"
|
|
"GITVER=${version}"
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
postInstall = ''
|
|
installManPage doc/masscan.?
|
|
|
|
install -Dm444 -t $out/etc/masscan data/exclude.conf
|
|
install -Dm444 -t $out/share/doc/masscan doc/*.{html,js,md}
|
|
install -Dm444 -t $out/share/licenses/masscan LICENSE
|
|
|
|
wrapProgram $out/bin/masscan \
|
|
--prefix LD_LIBRARY_PATH : "${libpcap}/lib"
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
$out/bin/masscan --selftest
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Fast scan of the Internet";
|
|
mainProgram = "masscan";
|
|
homepage = "https://github.com/robertdavidgraham/masscan";
|
|
changelog = "https://github.com/robertdavidgraham/masscan/releases/tag/${version}";
|
|
license = licenses.agpl3Only;
|
|
platforms = platforms.unix;
|
|
maintainers = with maintainers; [ rnhmjoj ];
|
|
};
|
|
}
|