about summary refs log tree commit diff
path: root/pkgs/development/python-modules/nix-kernel/default.nix
blob: a14a12b5b4f00abcdc1bb080abd75e9bc6157d55 (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
52
53
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  isPy3k,
  pexpect,
  notebook,
  nix,
}:

buildPythonPackage rec {
  pname = "nix-kernel";
  version = "unstable-2020-04-26";
  pyproject = true;

  disabled = !isPy3k;

  src = fetchFromGitHub {
    owner = "GTrunSec";
    repo = "nix-kernel";
    rev = "dfa42d0812d508ded99f690ee1a83281d900a3ec";
    sha256 = "1lf4rbbxjmq9h6g3wrdzx3v3dn1bndfmiybxiy0sjavgb6lzc8kq";
  };

  postPatch = ''
    substituteInPlace nix-kernel/kernel.py \
      --replace-fail "'nix'" "'${nix}/bin/nix'" \
      --replace-fail "'nix repl'" "'${nix}/bin/nix repl'"

    substituteInPlace setup.py \
      --replace-fail "cmdclass={'install': install_with_kernelspec}," ""
  '';

  build-system = [ setuptools ];

  dependencies = [
    pexpect
    notebook
  ];

  # no tests in repo
  doCheck = false;

  pythonImportsCheck = [ "nix-kernel" ];

  meta = with lib; {
    description = "Simple jupyter kernel for nix-repl";
    homepage = "https://github.com/GTrunSec/nix-kernel";
    license = licenses.mit;
    maintainers = [ ];
  };
}