1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, flit-core
6, ipykernel
7, isPy27
8, python
9, pexpect
10, bash
11}:
12
13buildPythonPackage rec {
14 pname = "bash_kernel";
15 version = "0.9.1";
16 format = "flit";
17 disabled = isPy27;
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "sha256-AYPVPjYP+baEcQUqmiiagWIXMlFrA04njpcgtdFaFis=";
22 };
23
24 patches = [
25 (fetchpatch {
26 url = "https://patch-diff.githubusercontent.com/raw/takluyver/bash_kernel/pull/69.diff";
27 sha256 = "1qd7qjjmcph4dk6j0bl31h2fdmfiyyazvrc9xqqj8y21ki2sl33j";
28 })
29 ];
30
31 postPatch = ''
32 substituteInPlace bash_kernel/kernel.py \
33 --replace "'bash'" "'${bash}/bin/bash'" \
34 --replace "\"bash\"" "'${bash}/bin/bash'"
35 '';
36
37 nativeBuildInputs = [ flit-core ];
38
39 propagatedBuildInputs = [ ipykernel pexpect ];
40
41 # no tests
42 doCheck = false;
43
44 preBuild = ''
45 export HOME=$TMPDIR
46 '';
47
48 postInstall = ''
49 ${python.pythonForBuild.interpreter} -m bash_kernel.install --prefix $out
50 '';
51
52 meta = with lib; {
53 description = "Bash Kernel for Jupyter";
54 homepage = "https://github.com/takluyver/bash_kernel";
55 changelog = "https://github.com/takluyver/bash_kernel/releases/tag/${version}";
56 license = licenses.bsd3;
57 maintainers = with maintainers; [ zimbatm ];
58 };
59}