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