#
A wrapper around mkDerivation
to build Pandoc documents with Nix
Put the following into your flake.nix
:
{
inputs = {
nix-pandoc.url = "github:serokell/nix-pandoc";
nix-pandoc.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, nix-pandoc }: {
defaultPackage = builtins.mapAttrs (system: pkgs: nix-pandoc.mkDoc.${system} {
name = "your-document-name";
src = ./.;
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
buildPhase = "pandoc --pdf-engine=xelatex -o $name.pdf ./your-document.md";
installPhase = "mkdir -p $out; cp $name.pdf $out";
}) nixpkgs.legacyPackages;
};
}
You may also want to place a Makefile in the root of your project that would contain instructions on how to build and install the files. If you do that, you can now do
{
inputs = {
nix-pandoc.url = "github:serokell/nix-pandoc";
nix-pandoc.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, nix-pandoc }: {
defaultPackage = builtins.mapAttrs (system: pkgs: nix-pandoc.mkDoc.${system} {
name = "your-document-name";
src = ./.;
}) nixpkgs.legacyPackages;
};
}
You can run nix build
to build your documents, or nix develop
to get
into a shell from where you can run make
to build your documents more
granularly.
Pass a font
argument to mkDoc
containing the path to your font’s package
(the font(s) must be located under share/fonts/
).
You may build your own texlive distribution with texlive.combined
and pass
it to mkDoc
as texlive-combined
.
You may pass extraTexInputs
, which should be a list of directories containing
sty
files that you may later use in your document.
This project is licensed under the Mozilla Public License, version 2.0; You may read more in ./LICENSE.
nix-pandoc is maintained and funded with ❤ by Serokell. The names and logo for Serokell are trademark of Serokell OÜ.
We love open source software! See our other projects or hire us to design, develop and grow your idea!