From 36ac761340091925019575914d9c424b82aa4c97 Mon Sep 17 00:00:00 2001
From: Daniel Fox Franke <dfoxfranke@gmail.com>
Date: Sat, 29 Aug 2015 15:20:20 -0400
Subject: [PATCH] expect: fix Darwin linkage

expect's build system doesn't seem to provide the proper linker flags
for the expect programs to be able to find libexpect on Darwin. (Stuff
like this should really just use libtool. *sigh*). Setting
DYLD_LIBRARY_PATH is an inelegant hack, but it gets the job done
without risking affecting other platforms.
---
 pkgs/tools/misc/expect/default.nix | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkgs/tools/misc/expect/default.nix b/pkgs/tools/misc/expect/default.nix
index c91d418d870..a50717d5399 100644
--- a/pkgs/tools/misc/expect/default.nix
+++ b/pkgs/tools/misc/expect/default.nix
@@ -1,8 +1,7 @@
 { stdenv, fetchurl, tcl, makeWrapper }:
 
-let version = "5.45";
-in
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
+  version = "5.45";
   name = "expect-${version}";
 
   src = fetchurl {
@@ -27,7 +26,8 @@ stdenv.mkDerivation {
     for i in $out/bin/*; do
       wrapProgram $i \
         --prefix PATH : "${tcl}/bin" \
-        --prefix TCLLIBPATH ' ' $out/lib/*
+        --prefix TCLLIBPATH ' ' $out/lib/* \
+        ${stdenv.lib.optionalString stdenv.isDarwin "--prefix DYLD_LIBRARY_PATH : $out/lib/expect${version}"}
     done
   '';
 
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
     description = "A tool for automating interactive applications";
     homepage = http://expect.nist.gov/;
     license = "Expect";
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     maintainers = with maintainers; [ wkennington ];
   };
 }