Last active
August 9, 2023 17:03
-
-
Save WolfangAukang/035d486aae0877f6322ebf2635f3e4d6 to your computer and use it in GitHub Desktop.
How to use Jupyter playbooks through Flakes (Nix)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "Jupyter playbook example"; | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | |
utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = { self, nixpkgs, utils }: | |
utils.lib.eachDefaultSystem (system: | |
let | |
pkgs = import nixpkgs { inherit system; }; | |
inherit (pkgs) mkShell; | |
inherit (pkgs.python3Packages) ansible-kernel jupyter-c-kernel ilua jupyterlab numpy scipy matplotlib; | |
inherit (pkgs.lib) concatMapStringsSep; | |
kernels = [ ansible-kernel jupyter-c-kernel ilua ]; | |
pyUtils = [ jupyterlab numpy scipy matplotlib ]; | |
in { | |
devShells.default = mkShell { | |
buildInputs = pyUtils; | |
shellHook = '' | |
# kernels | |
export JUPYTER_PATH="${concatMapStringsSep ":" (p: "${p}/share/jupyter/") kernels}" | |
echo Lets do some python | |
alias start="jupyter lab" | |
''; | |
}; | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment