about summary refs log tree commit diff
path: root/overrides
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2013-05-20 16:35:09 +0200
committeraszlig <aszlig@redmoonstudios.org>2013-05-20 16:35:09 +0200
commita304a5f19a0362894ee171cd9fa5a95b5213b683 (patch)
treeb7cde25ddf03b4a4cc957ff3dea7d57cdd7ead86 /overrides
parent8c3eef02d4b3f502c77f4f995105ae737a54b02d (diff)
fish: Correctly wrap Python tools.
This inserts pythonPath directly into the corresponding script file instead of
using wrapPythonPrograms or wrapProgram. It doesn't make sense to use a sh/bash
script in order to load a fish tool, right?

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'overrides')
-rw-r--r--overrides/fish/default.nix26
1 files changed, 19 insertions, 7 deletions
diff --git a/overrides/fish/default.nix b/overrides/fish/default.nix
index c8d8f7c8..bc37837b 100644
--- a/overrides/fish/default.nix
+++ b/overrides/fish/default.nix
@@ -1,12 +1,10 @@
-{ stdenv, fetchurl, autoconf, ncurses, groff, makeWrapper, pythonPackages }:
+{ stdenv, fetchurl, autoconf, ncurses, groff, pythonPackages }:
 
 stdenv.mkDerivation rec {
   name = "fish-${version}";
   version = "2.0.0";
 
-  buildInputs = [
-    autoconf ncurses makeWrapper pythonPackages.wrapPython pythonPackages.python
-  ];
+  buildInputs = [ autoconf ncurses pythonPackages.python ];
 
   pythonPath = [ pythonPackages.curses ];
 
@@ -18,9 +16,23 @@ stdenv.mkDerivation rec {
   '';
 
   postFixup = ''
-    wrapPythonPrograms
-
-    sed -i 's|nroff|${groff}/bin/nroff|g' \
+    gen_inserts() {
+      for i in $pythonPath; do
+        echo -n "; sys.path.insert(0, '$(toPythonPath "$i")')"
+      done
+    }
+
+    find "$out/share/fish/tools" -type f -perm +0100 -name '*.py' |
+    xargs sed -i -r \
+      -e '1 { /^#!/c #!${pythonPackages.python}/bin/python
+            }' \
+      -e '0,/^(from|import)/{/^(from|import)/a import sys'"$(gen_inserts)"'
+                            }'
+
+    sed -i -e "/Popen/s/'manpath'/'man', '-w'/p" \
+      "$out/share/fish/tools/create_manpage_completions.py"
+
+    sed -i -e 's|nroff|${groff}/bin/nroff|g' \
       "$out/share/fish/functions/__fish_print_help.fish"
   '';