slowlorust: add versionCheckHook

This commit is contained in:
Fabian Affolter
2024-12-03 11:16:36 +01:00
parent ab73ad0d48
commit 29657fce4b
@@ -4,6 +4,7 @@
fetchFromGitHub,
rustPlatform,
Security,
versionCheckHook,
}:
rustPlatform.buildRustPackage rec {
@@ -19,10 +20,22 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-Wu1mm+yJw2SddddxC5NfnMWLr+dplnRxH3AJ1/mTAKM=";
postPatch = ''
# https://github.com/MJVL/slowlorust/issues/2
substituteInPlace src/main.rs \
--replace-fail 'version = "1.0"' 'version = "${version}"'
'';
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
Security
];
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgramArg = [ "--version" ];
meta = with lib; {
description = "Lightweight slowloris (HTTP DoS) tool";
homepage = "https://github.com/MJVL/slowlorust";