1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00
nixpkgs/pkgs/tools/security/rustscan/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

55 lines
1.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
nmap,
perl,
python3,
rustPlatform,
Security,
}:
rustPlatform.buildRustPackage rec {
pname = "rustscan";
version = "2.3.0";
src = fetchFromGitHub {
owner = "RustScan";
repo = "RustScan";
rev = "refs/tags/${version}";
hash = "sha256-6heC/bHo4IqKNvPjch7AiyWTCZDCv4MZHC7DTEX3U5c=";
};
cargoHash = "sha256-Fr+m4BeYvUOoSkewwdUgpmdNchweeLK7v/tKLEzFOBs=";
postPatch = ''
substituteInPlace src/scripts/mod.rs \
--replace-fail 'call_format = "nmap' 'call_format = "${nmap}/bin/nmap'
patchShebangs fixtures/.rustscan_scripts/*
'';
buildInputs = lib.optional stdenv.hostPlatform.isDarwin Security;
nativeCheckInputs = [
perl
python3
];
checkFlags = [
# These tests require network access
"--skip=parse_correct_host_addresses"
"--skip=parse_hosts_file_and_incorrect_hosts"
"--skip=resolver_args_google_dns"
"--skip=resolver_default_cloudflare"
];
meta = with lib; {
description = "Faster Nmap Scanning with Rust";
homepage = "https://github.com/RustScan/RustScan";
changelog = "https://github.com/RustScan/RustScan/releases/tag/${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ figsoda ];
mainProgram = "rustscan";
};
}