{ 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.python310; 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; }; 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/ ''; }; jupyter-ihaskell = python.pkgs.buildPythonPackage rec { name = "jupyter-ihaskell"; format = "other"; unpackPhase = ": 3"; # we don't have any sources nativeBuildInputs = [ (python.withPackages (ps: with ps; [ jupyter jupyter-core ])) ]; # for some reason, ihaskell wants to create $HOME/.ihaskell # we set $HOME to $out, and then remove the .ihaskell file installPhase = '' mkdir -p $out HOME=$out ${pkgs.ihaskell}/bin/ihaskell install --prefix=$out rm -rf $out/.ihaskell ''; }; python-environment = (pkgs.python310.withPackages (ps: with ps; [ jupyter-core jupyter jupyter-config jupyter-ihaskell ])); in rec { packages.latex = latex; packages.python-environment = python-environment; packages.default = pkgs.writeScriptBin "start-notebook" '' env PATH=$PATH:${latex}/bin ${python-environment}/bin/jupyter-notebook ''; devShells.default = pkgs.mkShell { packages = [ python-environment latex ]; }; } ); }