Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09-beta 127 lines 3.7 kB view raw
1{ lib 2, buildPythonPackage 3, fetchPypi 4, fetchzip 5, alembic 6, ipython 7, jinja2 8, python-oauth2 9, prometheus_client 10, async_generator 11, pamela 12, sqlalchemy 13, tornado 14, traitlets 15, requests 16, notebook 17, pythonOlder 18, nodePackages 19, oauthlib 20, certipy 21, jupyter-telemetry 22}: 23 24let 25 # js/css assets that setup.py tries to fetch via `npm install` when building 26 # from source. 27 bootstrap = 28 fetchzip { 29 url = "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz"; 30 sha256 = "0r7s54bbf68ri1na9bbabyf12mcpb6zk5ja2q6z82aw1fa4xi3yd"; 31 }; 32 font-awesome = 33 fetchzip { 34 url = "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz"; 35 sha256 = "1xnxbdlfdd60z5ix152m8r2kk9dkwlqwpypky1mm3dv64ajnzdbk"; 36 }; 37 jquery = 38 fetchzip { 39 url = "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz"; 40 sha256 = "1j6y18miwzafdj8kfpwbmbn9qvgnbnpc7l4arqrhqj33m04xrlgi"; 41 }; 42 moment = 43 fetchzip { 44 url = "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz"; 45 sha256 = "12gb3p0rz5wyjwykv9g0pix7dd352lx1z7rzdjsf2brhwc4ffyip"; 46 }; 47 requirejs = 48 fetchzip { 49 url = "https://registry.npmjs.org/requirejs/-/requirejs-2.3.4.tgz"; 50 sha256 = "0q6mkj0iv341kks06dya6lfs2kdw0n6vc7n4a7aa3ia530fk9vja"; 51 }; 52 53in 54 55buildPythonPackage rec { 56 pname = "jupyterhub"; 57 version = "1.1.0"; 58 disabled = pythonOlder "3.5"; 59 60 src = fetchPypi { 61 inherit pname version; 62 sha256 = "1mqknz0rxqzx4nc57vscvfh2d4znzlzpy83ancqxdaq3b8i70al5"; 63 }; 64 65 # Most of this only applies when building from source (e.g. js/css assets are 66 # pre-built and bundled in the official release tarball on pypi). 67 # 68 # Stuff that's always needed: 69 # * At runtime, we need configurable-http-proxy, so we substitute the store 70 # path. 71 # 72 # Other stuff that's only needed when building from source: 73 # * js/css assets are fetched from npm. 74 # * substitute store path for `lessc` commmand. 75 # * set up NODE_PATH so `lessc` can find `less-plugin-clean-css`. 76 # * don't run `npm install`. 77 preBuild = '' 78 export NODE_PATH=${nodePackages.less-plugin-clean-css}/lib/node_modules 79 80 substituteInPlace jupyterhub/proxy.py --replace \ 81 "'configurable-http-proxy'" \ 82 "'${nodePackages.configurable-http-proxy}/bin/configurable-http-proxy'" 83 84 substituteInPlace jupyterhub/tests/test_proxy.py --replace \ 85 "'configurable-http-proxy'" \ 86 "'${nodePackages.configurable-http-proxy}/bin/configurable-http-proxy'" 87 88 substituteInPlace setup.py --replace \ 89 "'npm', 'run', 'lessc', '--'" \ 90 "'${nodePackages.less}/bin/lessc'" 91 92 substituteInPlace setup.py --replace \ 93 "'npm', 'install', '--progress=false'" \ 94 "'true'" 95 96 declare -A deps 97 deps[bootstrap]=${bootstrap} 98 deps[font-awesome]=${font-awesome} 99 deps[jquery]=${jquery} 100 deps[moment]=${moment} 101 deps[requirejs]=${requirejs} 102 103 mkdir -p share/jupyter/hub/static/components 104 for dep in "''${!deps[@]}"; do 105 if [ ! -e share/jupyter/hub/static/components/$dep ]; then 106 cp -r ''${deps[$dep]} share/jupyter/hub/static/components/$dep 107 fi 108 done 109 ''; 110 111 propagatedBuildInputs = [ 112 alembic ipython jinja2 pamela python-oauth2 requests sqlalchemy tornado 113 traitlets prometheus_client async_generator notebook certipy oauthlib 114 jupyter-telemetry 115 ]; 116 117 # Disable tests because they take an excessive amount of time to complete. 118 doCheck = false; 119 120 121 meta = with lib; { 122 description = "Serves multiple Jupyter notebook instances"; 123 homepage = "https://jupyter.org/"; 124 license = licenses.bsd3; 125 maintainers = with maintainers; [ ixxie cstrahan ]; 126 }; 127}