From 80a7a4295a72ac2b0a1752b32464036da7b06b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20S=C3=B8holm?= Date: Tue, 30 Jun 2020 23:25:48 +0200 Subject: [PATCH 1/2] nixos/jupyter: add package and command options --- .../services/development/jupyter/default.nix | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/development/jupyter/default.nix b/nixos/modules/services/development/jupyter/default.nix index e598b018645..6a5fd6b2940 100644 --- a/nixos/modules/services/development/jupyter/default.nix +++ b/nixos/modules/services/development/jupyter/default.nix @@ -6,10 +6,7 @@ let cfg = config.services.jupyter; - # NOTE: We don't use top-level jupyter because we don't - # want to pass in JUPYTER_PATH but use .environment instead, - # saving a rebuild. - package = pkgs.python3.pkgs.notebook; + package = cfg.package; kernels = (pkgs.jupyter-kernel.create { definitions = if cfg.kernels != null @@ -37,6 +34,27 @@ in { ''; }; + package = mkOption { + type = types.package; + # NOTE: We don't use top-level jupyter because we don't + # want to pass in JUPYTER_PATH but use .environment instead, + # saving a rebuild. + default = pkgs.python3.pkgs.notebook; + description = '' + Jupyter package to use. + ''; + }; + + command = mkOption { + type = types.str; + default = "jupyter-notebook"; + example = "jupyter-lab"; + description = '' + Which command the service runs. Note that not all jupyter packages + have all commands, e.g. jupyter-lab isn't present in the default package. + ''; + }; + port = mkOption { type = types.int; default = 8888; @@ -157,7 +175,7 @@ in { serviceConfig = { Restart = "always"; - ExecStart = ''${package}/bin/jupyter-notebook \ + ExecStart = ''${package}/bin/${cfg.command} \ --no-browser \ --ip=${cfg.ip} \ --port=${toString cfg.port} --port-retries 0 \ From a8b68fc49f4edeacad1919bd14443dead792fccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20S=C3=B8holm?= Date: Tue, 30 Jun 2020 23:26:49 +0200 Subject: [PATCH 2/2] evcxr: wrap evcxr_jupyter binary evcxr_jupyter needs the same wrapper as the main binary to work. --- pkgs/development/interpreters/evcxr/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/interpreters/evcxr/default.nix b/pkgs/development/interpreters/evcxr/default.nix index 4430298beb5..5d3d3de85dd 100644 --- a/pkgs/development/interpreters/evcxr/default.nix +++ b/pkgs/development/interpreters/evcxr/default.nix @@ -17,6 +17,7 @@ rustPlatform.buildRustPackage rec { buildInputs = stdenv.lib.optional stdenv.isDarwin Security; postInstall = '' wrapProgram $out/bin/evcxr --prefix PATH : ${stdenv.lib.makeBinPath [ cargo gcc ]} + wrapProgram $out/bin/evcxr_jupyter --prefix PATH : ${stdenv.lib.makeBinPath [ cargo gcc ]} rm $out/bin/testing_runtime '';