From ac3b9c9c30332a71e7f9f0119bf13d6dd67412da Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Wed, 11 Jun 2025 17:05:25 +0200 Subject: [PATCH] build PDF with Nix --- .gitignore | 1 + README.md | 16 ++++++++-------- default.nix | 28 ++++++++++++++++++++++++++++ shell.nix | 14 +------------- 4 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 default.nix diff --git a/.gitignore b/.gitignore index 5594b31..3e114b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +result *.err *.odt *.html diff --git a/README.md b/README.md index 66d0271..7e39390 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# fediversity proposal +# Fediversity project proposal -## usage +Build a PDF: -```sh -nix-shell -pandoc architecture.md -o architecture.html -pandoc architecture.html -o architecture.pdf -pandoc --filter pandoc-include fediversity.md -o fediversity.html -pandoc fediversity.html -o fediversity.pdf +> **Note** +> +> It will take a while to download dependencies! + +```bash +nix-build -A pdf ``` diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..93f6af6 --- /dev/null +++ b/default.nix @@ -0,0 +1,28 @@ +{ + pkgs ? import { }, +}: +{ + shell = pkgs.mkShellNoCC { + packages = with pkgs; [ + pandoc + pandoc-include + texliveMedium + librsvg + ]; + }; + pdf = + pkgs.runCommand "fediversity" + { + buildInputs = with pkgs; [ + pandoc + pandoc-include + texliveMedium + librsvg + ]; + } + '' + mkdir -p $out + pandoc ${./architecture.md} -o $out/architecture.pdf + pandoc --filter pandoc-include ${./fediversity.md} -o $out/fediversity.pdf + ''; +} diff --git a/shell.nix b/shell.nix index bf1305a..a6bdf20 100644 --- a/shell.nix +++ b/shell.nix @@ -1,13 +1 @@ -{ - pkgs ? import { }, -}: -{ - shell = pkgs.mkShellNoCC { - packages = with pkgs; [ - pandoc - pandoc-include - texliveMedium - librsvg - ]; - }; -} +(import ./. { }).shell