Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions nixos/modules/services/development/jupyter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
notebookConfig = pkgs.writeText "jupyter_config.py" ''
${cfg.notebookConfig}

c.NotebookApp.password = ${cfg.password}
${if cfg.usePassword then "c.NotebookApp.password = ${cfg.password}" else ""}
'';

in {
Expand All @@ -37,7 +37,7 @@ in {
# 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 = mkPackageOption pkgs [ "python3" "pkgs" "notebook" ] { };
package = mkPackageOption pkgs [ "python3" "pkgs" "notebook" "jupyterlab" ] { };

command = mkOption {
type = types.str;
Expand Down Expand Up @@ -86,10 +86,19 @@ in {
example = "users";
};

usePassword = mkOption {
type = types.bool;
default = false;
description = ''
Whether to use a password for the notebook.
'';
};

password = mkOption {
type = types.str;
default = "''";
description = ''
Password to use with notebook.
Password to use with the notebook. This option is only used if `usePassword` is set to true.
Can be generated using:
In [1]: from notebook.auth import passwd
In [2]: passwd('test')
Expand Down
15 changes: 11 additions & 4 deletions pkgs/applications/editors/jupyter/kernel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,26 @@ let

default = {
python3 = let
env = (python3.withPackages (ps: with ps; [ ipykernel ]));
env = python3.withPackages (pythonPackages: with pythonPackages; [
# Provide standard data science tools by default
ipykernel
numpy
pandas
matplotlib
scikit-learn
]);
in {
displayName = "Python 3";
argv = [
env.interpreter
"${env.interpreter}"
"-m"
"ipykernel_launcher"
"-f"
"{connection_file}"
];
language = "python";
logo32 = "${env}/${env.sitePackages}/ipykernel/resources/logo-32x32.png";
logo64 = "${env}/${env.sitePackages}/ipykernel/resources/logo-64x64.png";
logo32 = lib.mkIf (env.sitePackages != null) (builtins.toPath "/${env.sitePackages}/ipykernel/resources/logo-32x32.png");
logo64 = lib.mkIf (env.sitePackages != null) (builtins.toPath "/${env.sitePackages}/ipykernel/resources/logo-64x64.png");
};
};

Expand Down