summary refs log tree commit diff
path: root/pkgs/shells/xonsh/default.nix
blob: a2689fc64c193e907ecfb3d37fb59e09d0288093 (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
44
45
46
47
48
49
50
51
{ stdenv, fetchFromGitHub, python3Packages, glibcLocales, coreutils }:

python3Packages.buildPythonApplication rec {
  name = "xonsh-${version}";
  version = "0.4.3";

  src = fetchFromGitHub {
    owner = "scopatz";
    repo = "xonsh";
    rev = version;
    sha256= "1lx95i468px908y18fa9fmfgmjsydhkpas89dxbwfnybqxxyd3ls";
  };

  ## The logo xonsh prints during build contains unicode characters, and this
  ## fails because locales have not been set up in the build environment.
  ## We can fix this on Linux by setting:
  ##    export LOCALE_ARCHIVE=${pkgs.glibcLocales}/lib/locale/locale-archive
  ## but this would not be a cross platform solution, so it's simpler to just
  ## patch the setup.py script to not print the logo during build.
  #prePatch = ''
  #  substituteInPlace setup.py --replace "print(logo)" ""
  #'';
  patchPhase = ''
    rm xonsh/winutils.py
    sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" tests/test_execer.py
    sed -ie 's|test_win_ipconfig|_test_win_ipconfig|g' tests/test_execer.py
    sed -ie 's|test_ipconfig|_test_ipconfig|g' tests/test_execer.py
    rm tests/test_main.py
    rm tests/test_man.py
    rm tests/test_replay.py
  '';

  checkPhase = ''
    HOME=$TMPDIR XONSH_INTERACTIVE=0 nosetests -x
  '';

  buildInputs = with python3Packages; [ glibcLocales nose pytest ];
  propagatedBuildInputs = with python3Packages; [ ply prompt_toolkit ];

  meta = with stdenv.lib; {
    description = "A Python-ish, BASHwards-compatible shell";
    homepage = "http://xonsh.org";
    license = licenses.bsd3;
    maintainers = with maintainers; [ spwhitt garbas vrthra ];
    platforms = platforms.all;
  };

  passthru = {
    shellPath = "/bin/xonsh";
  };
}