latex template
This commit is contained in:
parent
5afb6b6d99
commit
4db22860c9
|
@ -1,10 +1,17 @@
|
|||
{ description = "My collection of flake templates";
|
||||
outputs = { self }: {
|
||||
templates = {
|
||||
|
||||
latex = {
|
||||
path = ./latex;
|
||||
description = "A fairly basic latex flake";
|
||||
};
|
||||
|
||||
trivial = {
|
||||
path = ./trivial;
|
||||
description = "What I consider to be the bare minimum flake";
|
||||
};
|
||||
|
||||
};
|
||||
defaultTemplate = self.templates.trivial;
|
||||
};
|
||||
|
|
1
latex/.envrc
Normal file
1
latex/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake
|
2
latex/.gitignore
vendored
Normal file
2
latex/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
result
|
||||
.direnv
|
48
latex/flake.nix
Normal file
48
latex/flake.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
# inspired by https://flyx.org/nix-flakes-latex/
|
||||
{ description = "A latex template";
|
||||
inputs = {
|
||||
nixpkgs.url = github:nixos/nixpkgs/nixos-23.05;
|
||||
flake-utils.url = github:numtide/flake-utils;
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-utils}:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = import nixpkgs { inherit system; };
|
||||
texInput = "main";
|
||||
# If you're not lazy, figure out what dependencies you need.
|
||||
# If you are lazy, just take the full scheme.
|
||||
tex = (pkgs.texlive.combine {
|
||||
inherit (pkgs.texlive) scheme-full;
|
||||
#scheme-basic latex-bin latexmk;
|
||||
});
|
||||
in {
|
||||
packages = rec {
|
||||
document = pkgs.stdenvNoCC.mkDerivation rec {
|
||||
pname = throw "put document name here";
|
||||
version = "0.0";
|
||||
src = ./src;
|
||||
buildInputs = with pkgs; [
|
||||
tex
|
||||
];
|
||||
buildPhase = ''
|
||||
mkdir -p .cache/texmf-var
|
||||
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
|
||||
latexmk -interaction=nonstopmode -pdf -lualatex \
|
||||
${texInput}.tex
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp ${texInput}.pdf $out/
|
||||
'';
|
||||
};
|
||||
default = document;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
texlab # my language server of choice
|
||||
tex
|
||||
];
|
||||
};
|
||||
|
||||
});
|
||||
}
|
14
latex/src/main.tex
Normal file
14
latex/src/main.tex
Normal file
|
@ -0,0 +1,14 @@
|
|||
\documentclass[a4paper,openany,twoside]{memoir}
|
||||
\usepackage[english]{babel}
|
||||
\usepackage[a-3u]{pdfx}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{lipsum}
|
||||
\usepackage[T1]{fontenc}
|
||||
\author{Marty Sluijtman}
|
||||
\title{On the Wonders of Bikes}
|
||||
\begin{document}
|
||||
\maketitle{}
|
||||
\tableofcontents{}
|
||||
|
||||
\end{document}
|
|
@ -10,10 +10,12 @@
|
|||
packages = rec {
|
||||
default = throw "put derivation information here";
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
(throw "put packages here")
|
||||
];
|
||||
};
|
||||
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue