summary refs log tree commit diff
path: root/pkgs/tools/misc/websocat/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/misc/websocat/default.nix')
-rw-r--r--pkgs/tools/misc/websocat/default.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/tools/misc/websocat/default.nix b/pkgs/tools/misc/websocat/default.nix
index 14617f207db..7870974531e 100644
--- a/pkgs/tools/misc/websocat/default.nix
+++ b/pkgs/tools/misc/websocat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkgconfig, openssl, rustPlatform, Security }:
+{ stdenv, fetchFromGitHub, pkgconfig, openssl, rustPlatform, Security, makeWrapper, bash }:
 
 rustPlatform.buildRustPackage rec {
   pname = "websocat";
@@ -14,9 +14,17 @@ rustPlatform.buildRustPackage rec {
   cargoBuildFlags = [ "--features=ssl" ];
   cargoSha256 = "09chj0bgf4r8v5cjq0hvb84zvh98nrzrh1m0wdqjy5gi7zc30cis";
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig makeWrapper ];
   buildInputs = [ openssl ] ++ stdenv.lib.optional stdenv.isDarwin Security;
 
+  # 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 \
+      --prefix PATH : ${stdenv.lib.makeBinPath [ bash ]}
+  '';
+
   meta = with stdenv.lib; {
     description = "Command-line client for WebSockets (like netcat/socat)";
     homepage = "https://github.com/vi/websocat";