2023-10-13 15:57:53 +02:00
{
description = " A j u p y t e r f l a k e , w i t h a c u s t o m h a s k e l l k e r n e l a n d p r o p e r p d f l a t e x L a T e X e x p o r t s u p o p r t " ;
inputs = {
flake-utils . url = " g i t h u b : n u m t i d e / f l a k e - u t i l s " ;
} ;
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 = " j u p y t e r - c o n f i g " ;
format = " o t h e r " ;
src = ./jupyter-config ;
installPhase = ''
find . - type f - exec sed - i ' s | <pdflatex> | $ { latex } /bin/pdflatex | g' { } +
mkdir - p $ out/etc/jupyter /
cp - r . $ out/etc/jupyter /
'' ;
} ;
jupyter-ihaskell = python . pkgs . buildPythonPackage rec {
name = " j u p y t e r - i h a s k e l l " ;
format = " o t h e r " ;
2023-10-13 17:09:55 +02:00
unpackPhase = " : 3 " ; # we don't have any sources
2023-10-13 15:57:53 +02:00
nativeBuildInputs = [ ( python . withPackages ( ps : with ps ; [ jupyter jupyter-core ] ) ) ] ;
2023-10-13 17:09:55 +02:00
# for some reason, ihaskell wants to create $HOME/.ihaskell
# we set $HOME to $out, and then remove the .ihaskell file
installPhase = ''
2023-10-13 15:57:53 +02:00
mkdir - p $ out
HOME = $ out $ { pkgs . ihaskell } /bin/ihaskell install - - prefix = $ out
2023-10-13 17:09:55 +02:00
rm - rf $ out/.ihaskell
2023-10-13 15:57:53 +02:00
'' ;
} ;
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 " s t a r t - n o t e b o o k " ''
2023-10-15 11:14:53 +02:00
env PATH = $ PATH:$ { latex } /bin : $ { pkgs . pandoc } /bin $ { python-environment } /bin/jupyter-notebook
2023-10-13 15:57:53 +02:00
'' ;
devShells . default = pkgs . mkShell {
packages = [ python-environment latex ] ;
} ;
}
) ;
}