{ description = "A jupyter flake, with a custom haskell kernel and proper pdflatex LaTeX export supoprt"; inputs = { flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (sys: let pkgs = import nixpkgs { system = sys; }; python = pkgs.python311; latex = pkgs.texlive.combine { inherit (pkgs.texlive) scheme-basic # Base tcolorbox pgf environ etoolbox pdfcol parskip caption float upquote eurosym ucs fancyvrb grffile adjustbox hyperref titling booktabs enumitem ulem soul rsfs jknapltx cm-super # Other packages needed by jupyter. tikz-among-us; # extra packages }; jupyter-config = python.pkgs.buildPythonPackage rec { name = "jupyter-config"; format = "other"; src = ./jupyter-config ; installPhase = '' find . -type f -exec sed -i 's||${latex}/bin/pdflatex|g' {} + mkdir -p $out/etc/jupyter/ cp -r . $out/etc/jupyter/ ''; }; python-environment = (python.withPackages (ps: with ps; [ ipympl numpy matplotlib scipy cvxpy jupyter-core jupyter jupyter-config ])); in rec { packages.latex = latex; packages.python-environment = python-environment; packages.default = pkgs.writeShellApplication { name = "start-notebook"; runtimeInputs = [latex pkgs.pandoc python-environment ]; text = "${python-environment}/bin/jupyter-notebook"; }; devShells.default = pkgs.mkShell { packages = [ python-environment latex ]; }; } ); }