about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIngo Blechschmidt <iblech@web.de>2020-04-24 04:37:49 +0200
committerAustin Seipp <aseipp@pobox.com>2020-04-24 11:11:24 -0500
commit1f57d5e060e097f014b8c700771d395af87990d0 (patch)
treeea7ac9b100fd304ed66221d9d6d2a7c8c4a6f055
parente170e0e85f9c72be1e83e6efb8e9bb44ff2fffe8 (diff)
downloadnixlib-1f57d5e060e097f014b8c700771d395af87990d0.tar
nixlib-1f57d5e060e097f014b8c700771d395af87990d0.tar.gz
nixlib-1f57d5e060e097f014b8c700771d395af87990d0.tar.bz2
nixlib-1f57d5e060e097f014b8c700771d395af87990d0.tar.lz
nixlib-1f57d5e060e097f014b8c700771d395af87990d0.tar.xz
nixlib-1f57d5e060e097f014b8c700771d395af87990d0.tar.zst
nixlib-1f57d5e060e097f014b8c700771d395af87990d0.zip
websocat: fix wrapping
-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 14617f207dbe..7870974531ee 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";