-
Notifications
You must be signed in to change notification settings - Fork 3
/
shell.nix
66 lines (59 loc) · 1.95 KB
/
shell.nix
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
{ pkgs ? import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs-channels/archive/76aafbf4bf4992c82da41ccefd8c6d481744524c.tar.gz";
sha256 = "1xz8249i9yag4sxfzd5lkhqsyg7n6h3n2klb1cqqmcsav87f6x65";
}) { overlays = []; }
}:
let self = rec {
# Update pythonPackages with setup.nix
pythonPackages = (import ./setup.nix {
inherit pkgs;
python = "python3";
pythonPackages = pkgs.python3Packages;
}).pythonPackages;
"robotframework-seleniumscreenshots" = (import ./setup.nix {
inherit pkgs;
python = "python3";
pythonPackages = pkgs.python3Packages;
}).build;
# Build jupyter with robotkernel
jupyter = pythonPackages.jupyter.overridePythonAttrs (old: {
propagatedBuildInputs =
with pythonPackages; old.propagatedBuildInputs ++ [
jupyterlab
# Packages available in the default Python kernel
robotframework
robotframework-seleniumlibrary
robotframework-seleniumscreenshots
robotkernel
];
});
# Configure Jupyter environment
jupyter_config_dir = pkgs.stdenv.mkDerivation {
name = "jupyter";
builder = with pythonPackages; pkgs.writeText "builder.sh" ''
source $stdenv/setup
mkdir -p $out/share/jupyter/nbextensions
mkdir -p $out/share/jupyter/migrated
${pythonPackages.python.withPackages (ps: with ps; [ robotkernel ])}/bin/python -m robotkernel.install --prefix=$out
# in the future we might build JupyterLab configuration here
'';
};
};
in with self;
pkgs.stdenv.mkDerivation {
name = "jupyter";
buildInputs = [
pkgs.firefox
pkgs.geckodriver
jupyter
jupyter_config_dir
];
shellHook = ''
mkdir -p $PWD/.jupyter
export JUPYTER_CONFIG_DIR=${jupyter_config_dir}/share/jupyter
export JUPYTER_PATH=${jupyter_config_dir}/share/jupyter
export JUPYTER_DATA_DIR=$PWD/.jupyter
export JUPYTER_RUNTIME_DIR=$PWD/.jupyter
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
'';
}