diff --git a/nixos/modules/services/development/jupyterhub/default.nix b/nixos/modules/services/development/jupyterhub/default.nix index 3e2d0979214b..be6aaed93ac6 100644 --- a/nixos/modules/services/development/jupyterhub/default.nix +++ b/nixos/modules/services/development/jupyterhub/default.nix @@ -67,8 +67,8 @@ in { this is a python file. ''; example = literalExample '' - c.SystemdSpawner.memory = "8G" - c.SystemdSpawner.cpus = "2" + c.SystemdSpawner.mem_limit = '8G' + c.SystemdSpawner.cpu_limit = 2.0 ''; }; diff --git a/pkgs/development/python-modules/jupyterhub-systemdspawner/default.nix b/pkgs/development/python-modules/jupyterhub-systemdspawner/default.nix new file mode 100644 index 000000000000..dc38acc66f7c --- /dev/null +++ b/pkgs/development/python-modules/jupyterhub-systemdspawner/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, jupyterhub +, tornado +, bash +}: + +buildPythonPackage rec { + pname = "jupyterhub-systemdspawner"; + version = "0.14"; + + src = fetchPypi { + inherit pname version; + sha256 = "080dd9cd9292266dad35d1efc7aa1af0ed6993d15eadc79bd959d1ee273d1923"; + }; + + propagatedBuildInputs = [ + jupyterhub + tornado + ]; + + postPatch = '' + substituteInPlace systemdspawner/systemd.py \ + --replace "/bin/bash" "${bash}/bin/bash" + + substituteInPlace systemdspawner/systemdspawner.py \ + --replace "/bin/bash" "${bash}/bin/bash" + ''; + + meta = with lib; { + description = "JupyterHub Spawner using systemd for resource isolation"; + homepage = "https://github.com/jupyterhub/systemdspawner"; + license = licenses.bsd3; + maintainers = [ maintainers.costrouc ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f5a435174db2..6229154b3257 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4481,6 +4481,10 @@ in { jupyterhub-ldapauthenticator = callPackage ../development/python-modules/jupyterhub-ldapauthenticator { }; + jupyterhub-systemdspawner = callPackage ../development/python-modules/jupyterhub-systemdspawner { + inherit (pkgs) bash; + }; + kaggle = callPackage ../development/python-modules/kaggle { }; keyring = if isPy3k then