From d9db6faf242808c69057876c1afaf39e9b5c17a0 Mon Sep 17 00:00:00 2001 From: janabhumi Date: Thu, 8 Sep 2022 17:53:22 +0300 Subject: [PATCH] add flake-jupyter --- flake.nix | 4 ++++ flakes/jupyter/flake.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 flakes/jupyter/flake.nix diff --git a/flake.nix b/flake.nix index 25c547a..e797a3b 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,10 @@ path = ./flakes/rust; description = "Flake to develop, build and run a rust application"; }; + flake-jupyter = { + path = ./flakes/jupyter; + description = "Flake to configure jupyter lab"; + }; # starters starter-typescript = { path = ./starters/typescript; diff --git a/flakes/jupyter/flake.nix b/flakes/jupyter/flake.nix new file mode 100644 index 0000000..5f1c71f --- /dev/null +++ b/flakes/jupyter/flake.nix @@ -0,0 +1,33 @@ +{ + inputs = { + jupyterWith.url = "github:tweag/jupyterWith"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, jupyterWith, utils }: + utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = builtins.attrValues jupyterWith.overlays; + }; + + # Source https://github.com/tweag/jupyterWith + iPython = pkgs.kernels.iPythonWith { + name = "python"; + packages = p: with p; [ numpy ]; + }; + + jupyterLab = pkgs.jupyterlabWith { + kernels = [ iPython ]; + }; + + in + { + apps.default = { + type = "app"; + program = "${jupyterLab}/bin/jupyter-lab"; + }; + devShell = jupyterLab.env; + }); +}