shobu aa6bfb373c add flake to provide environnement
added flake.nix to provide a build and dev environnement to bootstrap
	a venv with presenterm and weasyprint easily
added a package output to flake.nix to build all the posts.
	the build process use a python script for easier extensibility
2025-09-11 04:57:12 +02:00

15 lines
503 B
Python

import os
from pathlib import Path
from subprocess import run
posts = [post for topic in Path("./posts").iterdir() for post in topic.iterdir()]
config = Path(os.environ.get("PRES_CONFIG", "./configs/presenterm.yaml"))
out_dir = Path('./output')
out_dir.exists() or out_dir.mkdir()
for post_dir in posts:
run_result = run([f"presenterm -e --config-file {config} {post_dir / f'{post_dir.name}.md'}"], shell = True)
(post_dir / f'{post_dir.name}.pdf').replace(out_dir / f'{post_dir.name}.pdf')