diff --git a/pkgs/by-name/sl/slowlorust/package.nix b/pkgs/by-name/sl/slowlorust/package.nix new file mode 100644 index 000000000000..3d3ced6d29ec --- /dev/null +++ b/pkgs/by-name/sl/slowlorust/package.nix @@ -0,0 +1,45 @@ +{ + lib, + stdenv, + darwin, + fetchFromGitHub, + rustPlatform, + versionCheckHook, +}: + +rustPlatform.buildRustPackage rec { + pname = "slowlorust"; + version = "0.1.1"; + + src = fetchFromGitHub { + owner = "MJVL"; + repo = "slowlorust"; + rev = "refs/tags/${version}"; + hash = "sha256-c4NWkQ/QvlUo1YoV2s7rWB6wQskAP5Qp1WVM23wvV3c="; + }; + + 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.optional stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ]; + + nativeInstallCheckInputs = [ versionCheckHook ]; + + doInstallCheck = true; + + versionCheckProgramArg = [ "--version" ]; + + meta = with lib; { + description = "Lightweight slowloris (HTTP DoS) tool"; + homepage = "https://github.com/MJVL/slowlorust"; + changelog = "https://github.com/MJVL/slowlorust/releases/tag/${version}"; + license = licenses.mit; + maintainers = with maintainers; [ fab ]; + mainProgram = "slowlorust"; + }; +} diff --git a/pkgs/tools/networking/slowlorust/default.nix b/pkgs/tools/networking/slowlorust/default.nix deleted file mode 100644 index d5e924d10272..000000000000 --- a/pkgs/tools/networking/slowlorust/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, rustPlatform -, Security -}: - -rustPlatform.buildRustPackage rec { - pname = "slowlorust"; - version = "0.1.1"; - - src = fetchFromGitHub { - owner = "MJVL"; - repo = pname; - rev = version; - hash = "sha256-c4NWkQ/QvlUo1YoV2s7rWB6wQskAP5Qp1WVM23wvV3c="; - }; - - cargoHash = "sha256-Wu1mm+yJw2SddddxC5NfnMWLr+dplnRxH3AJ1/mTAKM="; - - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ - Security - ]; - - meta = with lib; { - description = "Lightweight slowloris (HTTP DoS) tool"; - homepage = "https://github.com/MJVL/slowlorust"; - license = licenses.mit; - maintainers = with maintainers; [ fab ]; - mainProgram = "slowlorust"; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 37084b9cf748..e70b546b1942 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5230,10 +5230,6 @@ with pkgs; ocamlPackages = ocaml-ng.ocamlPackages_4_12; }; - slowlorust = callPackage ../tools/networking/slowlorust { - inherit (darwin.apple_sdk.frameworks) Security; - }; - slstatus = callPackage ../applications/misc/slstatus { conf = config.slstatus.conf or null; };