2021-05-18 19:04:13 +02:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config, openssl, rustPlatform, libiconv
|
|
|
|
, Security, makeWrapper, bash }:
|
2019-03-10 04:43:27 +01:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
2019-08-31 13:41:23 +02:00
|
|
|
pname = "websocat";
|
2021-04-20 21:25:40 +02:00
|
|
|
version = "1.8.0";
|
2019-03-10 04:43:27 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2019-12-05 17:40:54 +01:00
|
|
|
owner = "vi";
|
2021-04-20 21:25:40 +02:00
|
|
|
repo = pname;
|
2019-12-05 17:40:54 +01:00
|
|
|
rev = "v${version}";
|
2021-04-20 21:25:40 +02:00
|
|
|
sha256 = "sha256-jwoWxK4phBqhIeo3+oRnpGsfvtn9gTR1ryd4N+0Lmbw=";
|
2019-03-10 04:43:27 +01:00
|
|
|
};
|
|
|
|
|
2019-06-04 10:28:04 +02:00
|
|
|
cargoBuildFlags = [ "--features=ssl" ];
|
2021-04-20 21:25:40 +02:00
|
|
|
cargoSha256 = "sha256-+3SG1maarY4DJ4+QiYGwltGLksOoOhKtcqstRwgzi2k=";
|
2019-03-10 04:43:27 +01:00
|
|
|
|
2021-01-17 04:51:22 +01:00
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
2021-05-18 19:04:13 +02:00
|
|
|
buildInputs = [ openssl ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ libiconv Security ];
|
2019-03-19 09:21:18 +01:00
|
|
|
|
2021-04-20 21:25:40 +02:00
|
|
|
# Needed to get openssl-sys to use pkg-config.
|
|
|
|
OPENSSL_NO_VENDOR=1;
|
|
|
|
|
2020-04-24 04:37:49 +02:00
|
|
|
# The wrapping is required so that the "sh-c" option of websocat works even
|
|
|
|
# if sh is not in the PATH (as can happen, for instance, when websocat is
|
|
|
|
# started as a systemd service).
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/websocat \
|
2021-01-15 10:19:50 +01:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ bash ]}
|
2020-04-24 04:37:49 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-12-05 17:40:54 +01:00
|
|
|
homepage = "https://github.com/vi/websocat";
|
2021-04-20 21:25:40 +02:00
|
|
|
description = "Command-line client for WebSockets (like netcat/socat)";
|
|
|
|
changelog = "https://github.com/vi/websocat/releases/tag/v${version}";
|
2019-12-05 17:40:54 +01:00
|
|
|
license = licenses.mit;
|
2020-11-17 12:02:06 +01:00
|
|
|
maintainers = with maintainers; [ thoughtpolice Br1ght0ne ];
|
2019-03-10 04:43:27 +01:00
|
|
|
};
|
|
|
|
}
|