about summary refs log tree commit diff
path: root/pkgs/development/python-modules/bash-kernel/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/bash-kernel/default.nix')
-rw-r--r--pkgs/development/python-modules/bash-kernel/default.nix42
1 files changed, 26 insertions, 16 deletions
diff --git a/pkgs/development/python-modules/bash-kernel/default.nix b/pkgs/development/python-modules/bash-kernel/default.nix
index c3ab6083ba1dd..0df270f8a2b7a 100644
--- a/pkgs/development/python-modules/bash-kernel/default.nix
+++ b/pkgs/development/python-modules/bash-kernel/default.nix
@@ -1,13 +1,13 @@
-{ lib
-, buildPythonPackage
-, fetchPypi
-, fetchpatch
-, flit-core
-, ipykernel
-, python
-, pexpect
-, bash
-, substituteAll
+{
+  lib,
+  buildPythonPackage,
+  fetchPypi,
+  flit-core,
+  ipykernel,
+  python,
+  pexpect,
+  bashInteractive,
+  substituteAll,
 }:
 
 buildPythonPackage rec {
@@ -24,13 +24,11 @@ buildPythonPackage rec {
   patches = [
     (substituteAll {
       src = ./bash-path.patch;
-      bash = lib.getExe bash;
+      bash = lib.getExe bashInteractive;
     })
   ];
 
-  nativeBuildInputs = [
-    flit-core
-  ];
+  nativeBuildInputs = [ flit-core ];
 
   propagatedBuildInputs = [
     ipykernel
@@ -45,8 +43,20 @@ buildPythonPackage rec {
     ${python.pythonOnBuildForHost.interpreter} -m bash_kernel.install --prefix $out
   '';
 
-  # no tests
-  doCheck = false;
+  checkPhase = ''
+    runHook preCheck
+
+    # Create a JUPYTER_PATH with the kernelspec
+    export JUPYTER_PATH=$(mktemp -d)
+    mkdir -p $JUPYTER_PATH/kernels/bash
+    echo '{ "language": "bash", "argv": [ "${python}/bin/python", "-m", "bash_kernel", "-f", "{connection_file}" ] }' > $JUPYTER_PATH/kernels/bash/kernel.json
+
+    # Evaluate a test notebook with papermill
+    cd $(mktemp -d)
+    ${python.withPackages (ps: [ ps.papermill ])}/bin/papermill --kernel bash ${./test.ipynb} out.ipynb
+
+    runHook postCheck
+  '';
 
   meta = with lib; {
     description = "Bash Kernel for Jupyter";