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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
{
lib,
buildPythonPackage,
fetchPypi,
writeText,
setuptools,
ipywidgets,
six,
docopt,
tqdm,
jupyter,
psutil,
pyyaml,
ansible-runner,
ansible,
python,
}:
let
kernelSpecFile = writeText "kernel.json" (
builtins.toJSON {
argv = [
python.interpreter
"-m"
"ansible_kernel"
"-f"
"{connection_file}"
];
codemirror_mode = "yaml";
display_name = "Ansible";
language = "ansible";
}
);
in
buildPythonPackage rec {
pname = "ansible-kernel";
version = "1.0.0";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-UJjm9FpmXSznXtaIR2rVv5YJS/H83FvRkNz09vwoe0c=";
};
build-system = [ setuptools ];
dependencies = [
ipywidgets
six
docopt
tqdm
jupyter
psutil
pyyaml
ansible-runner
ansible
];
postPatch = ''
# remove when merged
# https://github.com/ansible/ansible-jupyter-kernel/pull/82
touch LICENSE.md
# remove custom install
sed -i "s/cmdclass={'install': Installer},//" setup.py
'';
# tests hang with launched kernel
doCheck = false;
# install kernel manually
postInstall = ''
mkdir -p $out/share/jupyter/kernels/ansible/
ln -s ${kernelSpecFile} $out/share/jupyter/kernels/ansible/kernel.json
'';
meta = {
description = "Ansible kernel for Jupyter";
homepage = "https://github.com/ansible/ansible-jupyter-kernel";
license = lib.licenses.asl20;
maintainers = [ ];
};
}
|