This is a repository of Nix package expressions for creating beautiful letters using Pandoc/LaTeX. Pandoc templates in use are:
letter
class.scrlttr2
class. This template is a mix
between the one from Aaron and Jens.Find an example of letter in the latest release section.
You have two options:
nix run
to compile a PDF from a
Markdown file:
nix run github:drupol/latex-letter#letter -- --output=letter.pdf --from=markdown /path/to/letter.md
nix run github:drupol/latex-letter#letter-scrlttr2 -- --output=letter.pdf --from=markdown /path/to/letter.md
nix run github:drupol/latex-letter#watch-letter -- --output=letter.pdf --from=markdown /path/to/letter.md
nix run github:drupol/latex-letter#watch-letter-scrlttr2 -- --output=letter.pdf --from=markdown /path/to/letter.md
nix flake new --template github:drupol/latex-letter#default ./my-new-document
Create a new letter by creating a new project:
nix flake new --template github:drupol/latex-letter#default ./my-new-document
Then go into the new directory:
cd ./my-new-document
Then build the letter:
nix build .#letter
or
nix build .#letter-scrlttr2
Then open the resulting letter in PDF:
open result/letter.pdf
This package is contains a flake.nix
which exposes its derivations in an
overlay.
Exposed derivations:
pandoc-letter-template
: The derivation of the Pandoc letter
templatepandoc-letter-scrlttr2-template
: The derivation of the Pandoc letter
scrlttr2
templateTo use it in your own package, here's a minimum working example:
{
description = "Simple flake with Pandoc latex letter";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
latex-letter.url = "github:drupol/latex-letter";
};
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system: let
pkgs = import inputs.nixpkgs {
overlays = [inputs.latex-letter.overlays.default];
inherit system;
};
tex = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-full latex-bin latexmk;
};
pandoc-templates = pkgs.symlinkJoin {
name = "pandoc-templates";
paths = [
pkgs.pandoc-letter-scrlttr2-template
pkgs.pandoc-letter-template
];
};
pandoc = pkgs.writeShellApplication {
name = "pandoc";
text = ''
pandoc --data-dir=${pandoc-templates}/share/pandoc/ "$@"
'';
runtimeInputs = [tex pkgs.pandoc];
};
in {
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShellNoCC {
name = "latex-letter-devshell";
buildInputs = [pandoc];
};
});
}