Browse Source

Add base build utility

Samuel W. Flint 4 years ago
commit
724fb99933
5 changed files with 260 additions and 0 deletions
  1. 168 0
      .gitignore
  2. 28 0
      .latexmkrc
  3. 21 0
      Makefile
  4. 3 0
      README.md
  5. 40 0
      default.nix

+ 168 - 0
.gitignore

@@ -0,0 +1,168 @@
+# -*- mode: gitignore; -*-
+.*
+!.gitignore
+!.gitmodules
+!.gitkeep
+
+!.latexmkrc
+result
+
+# Emacs Stuff
+*~
+\#*\#
+/.emacs.desktop
+/.emacs.desktop.lock
+*.elc
+auto-save-list
+tramp
+.\#*
+
+# Org-mode
+.org-id-locations
+*_archive
+
+# flymake-mode
+*_flymake.*
+
+# eshell files
+/eshell/history
+/eshell/lastdir
+
+# elpa packages
+/elpa/
+
+# reftex files
+*.rel
+
+# AUCTeX auto folder
+/auto/
+*/auto/
+
+# cask packages
+.cask/
+dist/
+
+# Flycheck
+flycheck_*.el
+
+# server auth directory
+/server/
+
+# projectiles files
+.projectile
+
+## Core latex/pdflatex auxiliary files:
+*.aux
+*.lof
+*.log
+*.lot
+*.fls
+*.out
+*.toc
+*.fmt
+*.fot
+*.cb
+*.cb2
+
+## Intermediate documents:
+*.dvi
+*.ps
+*.eps
+*.pdf
+
+## Bibliography auxiliary files (bibtex/biblatex/biber):
+*.bbl
+*.bcf
+*.blg
+*-blx.aux
+*-blx.bib
+*.brf
+*.run.xml
+
+## Build tool auxiliary files:
+*.fdb_latexmk
+*.synctex
+*.synctex.gz
+*.synctex.gz(busy)
+*.pdfsync
+
+## Auxiliary and intermediate files from other packages:
+# algorithms
+*.alg
+*.loa
+
+# achemso
+acs-*.bib
+
+# amsthm
+*.thm
+
+# beamer
+*.nav
+*.snm
+*.vrb
+
+# glossaries
+*.acn
+*.acr
+*.glg
+*.glo
+*.gls
+*.glsdefs
+
+# hyperref
+*.brf
+
+# listings
+*.lol
+
+# makeidx
+*.idx
+*.ilg
+*.ind
+*.ist
+
+# minitoc
+*.maf
+*.mlf
+*.mlt
+*.mtc
+*.mtc[0-9]
+*.mtc[1-9][0-9]
+
+# minted
+_minted*
+*.pyg
+
+# mylatexformat
+*.fmt
+
+# nomencl
+*.nlo
+
+# sympy
+*.sout
+*.sympy
+sympy-plots-for-*.tex/
+
+# pdfcomment
+*.upa
+*.upb
+
+# thmtools
+*.loe
+
+# TikZ & PGF
+*.dpth
+*.md5
+*.auxlock
+
+# xindy
+*.xdy
+
+# xypic precompiled matrices
+*.xyc
+
+# endfloat
+*.ttt
+*.fff

+ 28 - 0
.latexmkrc

@@ -0,0 +1,28 @@
+# -*- cperl -*-
+
+$ENV{'TEXINPUTS'} = './texmf//:' . $ENV{'TEXINPUTS'};
+
+push @generated_exts, 'glo', 'gls', 'glg';
+push @generated_exts, 'acn', 'acr', 'alg';
+$clean_ext .= ' %R.ist %R.xdy';
+
+add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');
+add_cus_dep('acn', 'acr', 0, 'run_makeglossaries');
+
+sub run_makeglossaries {
+    print "\t\tBulding Glossaries\n";
+  if ( $silent ) {
+    system "makeglossaries -q '$_[0]'";
+  }
+  else {
+    system "makeglossaries '$_[0]'";
+  };
+}
+
+sub eps2pdf {
+   system("epstopdf --hires $_[0].eps"); 
+}
+
+add_cus_dep("eps", "pdf", 0, "eps2pdf");
+
+set_tex_cmds(' -shell-escape -synctex=1 %O %S');

+ 21 - 0
Makefile

@@ -0,0 +1,21 @@
+DIST=document.pdf
+
+export TEXINPUTS := ./texmf/:$(TEXINPUTS)
+
+.PHONY: all clean install continuous
+
+all: $(DIST)
+
+%.pdf: %.tex
+	latexmk -pdf $<
+
+continuous: $(DIST)
+	latexmk -pdf -pvc -interaction=nonstopmode $<
+
+clean:
+	latexmk -CA $(DIST)
+	$(RM) $(JUNK_TEX)
+
+install: $(DIST)
+	mkdir -pv ${out}/nix-support/
+	cp -t ${out} $^

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# nix-build-pdf
+
+Running `nix-build` in this directory will build `document.tex`.  If `document.tex` has additional build requirements, add them to `default.nix`.  The document may be continuously built by running `nix run -c make continuous`.

+ 40 - 0
default.nix

@@ -0,0 +1,40 @@
+{ nixpkgs ? import <nixpkgs>{} }:
+
+with nixpkgs;
+
+stdenv.mkDerivation rec {
+
+  name = "document";
+
+  src = ./.;
+
+  buildInputs = [
+    (texlive.combine {
+      inherit (texlive)
+        scheme-small
+
+      # Directly required packages
+        latexmk
+        csquotes
+        everypage
+        marginnote
+        glossaries
+
+      # Apparently required
+        mfirstuc
+        xfor
+        datatool
+        substr
+        tracklang
+      ;    
+    })
+  ];
+
+  buildPhase = "make";
+
+  # meta = with lib; {
+  #   description = "Description";
+  #   licenses = licenses.nonfree;
+  #   author = "Name <email>";
+  # };
+}