nixpkgs/pkgs/by-name/ni/nikto/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

72 lines
1.8 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
perlPackages,
makeWrapper,
installShellFiles,
}:
let
version = "2.5.0";
in
stdenv.mkDerivation rec {
pname = "nikto";
inherit version;
src = fetchFromGitHub {
owner = "sullo";
repo = "nikto";
rev = version;
sha256 = "sha256-lWiDbWc2BWAUgyaIm0tvZytja02WogYRoc7na4sHiNM=";
};
# Nikto searches its configuration file based on its current path
# This fixes the current path regex for the wrapped executable.
patches = [ ./nix-wrapper-fix.patch ];
postPatch = ''
# EXECDIR needs to be changed to the path where we copy the programs stuff
# Forcing SSLeay is needed for SSL support (the auto mode doesn't seem to work otherwise)
substituteInPlace program/nikto.conf.default \
--replace "# EXECDIR=/opt/nikto" "EXECDIR=$out/share" \
--replace "LW_SSL_ENGINE=auto" "LW_SSL_ENGINE=SSLeay"
'';
nativeBuildInputs = [
makeWrapper
installShellFiles
];
buildInputs = [
perlPackages.perl
perlPackages.NetSSLeay
];
installPhase = ''
runHook preInstall
install -d "$out/share"
cp -a program/* "$out/share"
install -Dm 755 "program/nikto.pl" "$out/bin/nikto"
install -Dm 644 program/nikto.conf.default "$out/etc/nikto.conf"
installManPage documentation/nikto.1
install -Dm 644 README.md "$out/share/doc/${pname}/README"
runHook postInstall
'';
postInstall = ''
wrapProgram $out/bin/nikto \
--prefix PERL5LIB : $PERL5LIB
'';
meta = with lib; {
description = "Web server scanner";
mainProgram = "nikto";
license = licenses.gpl2Plus;
homepage = "https://cirt.net/Nikto2";
changelog = "https://github.com/sullo/nikto/releases/tag/${version}";
maintainers = with maintainers; [ shamilton ];
platforms = platforms.unix;
};
}