about summary refs log tree commit diff
path: root/pkgs/fish/default.nix
blob: bc37837ba666290a7a2e883a9f8e15e567c14bb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ stdenv, fetchurl, autoconf, ncurses, groff, pythonPackages }:

stdenv.mkDerivation rec {
  name = "fish-${version}";
  version = "2.0.0";

  buildInputs = [ autoconf ncurses pythonPackages.python ];

  pythonPath = [ pythonPackages.curses ];

  enableParallelBuilding = true;

  preConfigure = ''
    autoconf
    sed -i 's/\<which\>/type -P/g' configure
  '';

  postFixup = ''
    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"
  '';

  src = fetchurl {
    url = "http://fishshell.com/files/${version}/fish.tar.gz";
    sha1 = "2d28553e2ff975f8e5fed6b266f7a940493b6636";
  };
}