summary refs log tree commit diff
path: root/pkgs/tools/misc/expect/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/misc/expect/default.nix')
-rw-r--r--pkgs/tools/misc/expect/default.nix14
1 files changed, 10 insertions, 4 deletions
diff --git a/pkgs/tools/misc/expect/default.nix b/pkgs/tools/misc/expect/default.nix
index 2b1108846d7..bfb36993388 100644
--- a/pkgs/tools/misc/expect/default.nix
+++ b/pkgs/tools/misc/expect/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, tcl }:
+{ stdenv, fetchurl, tcl, makeWrapper }:
 
 let version = "5.45";
 in
@@ -11,6 +11,7 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ tcl ];
+  nativeBuildInputs = [ makeWrapper ];
 
   #NIX_CFLAGS_COMPILE = "-DHAVE_UNISTD_H";
 
@@ -30,11 +31,16 @@ stdenv.mkDerivation {
   configureFlags = [
     "--with-tcl=${tcl}/lib"
     "--with-tclinclude=${tcl}/include"
-    "--exec-prefix=$out"
+    "--exec-prefix=$(out)"
   ];
 
-  postInstall = let libSuff = if stdenv.isDarwin then "dylib" else "so";
-    in "cp expect $out/bin; mkdir -p $out/lib; cp *.${libSuff} $out/lib";
+  postInstall = ''
+    for i in $out/bin/*; do
+      wrapProgram $i \
+        --prefix PATH : "${tcl}/bin" \
+        --prefix TCLLIBPATH ' ' $out/lib/*
+    done
+  '';
 
   meta = {
     description = "A tool for automating interactive applications";