aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2020-06-03 20:32:10 +0200
committerAdrian Kummerlaender2020-06-03 20:32:10 +0200
commita4a84f87350ff36b1c9508e79583f3cc64909f3b (patch)
tree501cb7184b586a8b593e02420a70bf2a80182ba4
parentb11624d35da6219ce769b3e41c9ee33599603c97 (diff)
downloadnixos_home-a4a84f87350ff36b1c9508e79583f3cc64909f3b.tar
nixos_home-a4a84f87350ff36b1c9508e79583f3cc64909f3b.tar.gz
nixos_home-a4a84f87350ff36b1c9508e79583f3cc64909f3b.tar.bz2
nixos_home-a4a84f87350ff36b1c9508e79583f3cc64909f3b.tar.lz
nixos_home-a4a84f87350ff36b1c9508e79583f3cc64909f3b.tar.xz
nixos_home-a4a84f87350ff36b1c9508e79583f3cc64909f3b.tar.zst
nixos_home-a4a84f87350ff36b1c9508e79583f3cc64909f3b.zip
Explicitly depend on env for Jupyter tasks
This way the Jupyter environment is built during home instantiation and not only when actually calling the launcher script. This solves various GC and network availability related issues for this task type.
-rw-r--r--module/tasker.nix9
-rw-r--r--tasks/default.nix4
2 files changed, 6 insertions, 7 deletions
diff --git a/module/tasker.nix b/module/tasker.nix
index b79d854..112da88 100644
--- a/module/tasker.nix
+++ b/module/tasker.nix
@@ -11,9 +11,8 @@ let
#!/bin/sh
exec ${pkgs.kitty}/bin/kitty -d ${dir} ${cmd}
'';
- launchJupyterInDirectory = dir: env: ''
- #!/usr/bin/env nix-shell
- #!nix-shell ${builtins.unsafeDiscardStringContext env.drvPath} -i fish
+ launchJupyterInDirectory = dir: jupyter: ''
+ #!/usr/bin/env fish
for port in (seq 9000 9100)
if not ss --listening --oneline --tcp --no-header | awk '{ split($4, port, ":"); print port[2]+0 }' | grep -q $port
@@ -23,7 +22,7 @@ let
end
set token (head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
- jupyter lab --no-browser --port=$free_port --NotebookApp.token=$token &
+ ${jupyter}/bin/jupyter-lab --no-browser --port=$free_port --NotebookApp.token=$token &
sleep 2
${pkgs.chromium}/bin/chromium --app="http://localhost:$free_port/?token=$token"
kill (jobs -lp)
@@ -69,7 +68,7 @@ let
in pkgs.symlinkJoin {
name = "tasker_task_" + name;
- paths = [ command shortcut ];
+ paths = [ shortcut ];
}) config.custom.tasks;
in {
diff --git a/tasks/default.nix b/tasks/default.nix
index 124f1cc..b3c0a1a 100644
--- a/tasks/default.nix
+++ b/tasks/default.nix
@@ -32,9 +32,9 @@ let
rev = "7a6716f0c0a5538691a2f71a9f12b066bce7d55c";
}) {};
- mkJupyterEnv = kernel: (jupyter.jupyterlabWith {
+ mkJupyterEnv = kernel: jupyter.jupyterlabWith {
kernels = [ kernel ];
- }).env;
+ };
in {
custom.tasks = {