From ecdd41065876f24db7351bf2acc55f5093566e2c Mon Sep 17 00:00:00 2001 From: Ethan Reece Date: Sun, 9 Feb 2025 19:53:44 +0000 Subject: [PATCH] Initial commit --- .gitignore | 14 +++++++++++++ .guix-channel | 3 +++ .guix/modules/template-package.scm | 27 ++++++++++++++++++++++++ Justfile | 11 ++++++++++ README.md | 9 ++++++++ channels.scm | 27 ++++++++++++++++++++++++ manifest.scm | 5 +++++ src/document.tex | 33 ++++++++++++++++++++++++++++++ 8 files changed, 129 insertions(+) create mode 100644 .gitignore create mode 100644 .guix-channel create mode 100644 .guix/modules/template-package.scm create mode 100644 Justfile create mode 100644 README.md create mode 100644 channels.scm create mode 100644 manifest.scm create mode 100644 src/document.tex diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..abf1255 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.eps +*.go +*.log +*.mo +*.pdf +*.png +*.tar.xz +*.tmp +*~ +.#* +\#*\# +,* +.DS_Store +out diff --git a/.guix-channel b/.guix-channel new file mode 100644 index 0000000..9ef7a67 --- /dev/null +++ b/.guix-channel @@ -0,0 +1,3 @@ +(channel + (version 0) + (directory ".guix/modules")) \ No newline at end of file diff --git a/.guix/modules/template-package.scm b/.guix/modules/template-package.scm new file mode 100644 index 0000000..1e42c56 --- /dev/null +++ b/.guix/modules/template-package.scm @@ -0,0 +1,27 @@ +(add-to-load-path ".") +(define-module (template-package) + #:use-module (gnu packages tex) + #:use-module (guix) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix git-download)) + +(define vcs-file? + ;; Return true if the given file is under version control. + (or (git-predicate (current-source-directory)) + (const #t))) + +(define-public template + (package + (name "template") + (version "0.1-git") + (source (local-file "../.." "template-checkout" + #:recursive? #t + #:select? vcs-file?)) + (build-system gnu-build-system) + (native-inputs + `(typst)) + (synopsis "Guix template for LaTeX projects") + (description "Guix template for LaTeX projects") + (home-page "https://git.sudoer777.dev/me/guix-latex-template") + (license license:expat))) diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..d15d952 --- /dev/null +++ b/Justfile @@ -0,0 +1,11 @@ +default: + guix time-machine --channels=./channels.scm.lock -- shell --container --emulate-fhs --manifest=./manifest.scm -- sh -c "mkdir -p ./out && lualatex -output-directory=./out ./src/document.tex" + +dev: + guix time-machine --channels=./channels.scm.lock -- shell --manifest=./manifest.scm + +update: + guix time-machine --channels=./channels.scm -- describe --format=channels > ./channels.scm.lock + +run: default + xdg-open ./out/document.pdf diff --git a/README.md b/README.md new file mode 100644 index 0000000..fc5d04a --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Guix LaTeX project template + +1. Modify `./guix/modules/template-package.scm` (defines the project), `./channels.scm` (for project dependencies), and `./manifest.scm` (for development environment) to your requirements. + +1. Install `just` by adding to your Guix Home configuration or running `guix install just`. + +1. Run `just update` to update the dependencies. + +1. Run `just` to generate the document. Run `just run` to generate then open the document. Run `just dev` to open a shell environment with the document's dependencies. diff --git a/channels.scm b/channels.scm new file mode 100644 index 0000000..4fb318e --- /dev/null +++ b/channels.scm @@ -0,0 +1,27 @@ +(list (channel + (name 'guix) + (url "https://git.savannah.gnu.org/git/guix.git") + (branch "master") + (introduction + (make-channel-introduction + "9edb3f66fd807b096b48283debdcddccfea34bad" + (openpgp-fingerprint + "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))) + (channel + (name 'kbg) + (url "https://git.sr.ht/~kennyballou/guix-channel") + (branch "master") + (introduction + (make-channel-introduction + "b9d0b8041d28ebd9f85cb041aa3f2235c8b39417" + (openpgp-fingerprint + "10F4 14AB D526 0D0E 2372 8C08 FE55 890B 57AE DCE5")))) + (channel + (name 'saayix) + (url "https://codeberg.org/look/saayix") + (branch "main") + (introduction + (make-channel-introduction + "12540f593092e9a177eb8a974a57bb4892327752" + (openpgp-fingerprint + "3FFA 7335 973E 0A49 47FC 0A8C 38D5 96BE 07D3 34AB"))))) diff --git a/manifest.scm b/manifest.scm new file mode 100644 index 0000000..6a7b3d0 --- /dev/null +++ b/manifest.scm @@ -0,0 +1,5 @@ +(add-to-load-path ".guix/modules") +(use-modules (template-package) + (gnu packages tex)) + +(packages->manifest (list texlive-scheme-basic texlive-cm-super texlive-hyperref texlive-etoolbox texlive-pgf texlive-geometry coreutils ltex-ls texlab)) diff --git a/src/document.tex b/src/document.tex new file mode 100644 index 0000000..91e47b7 --- /dev/null +++ b/src/document.tex @@ -0,0 +1,33 @@ +% This is a comment in LaTeX + +% Preamble: This is where you define the document class, packages, and other settings +\documentclass{article} +\usepackage[utf8]{inputenc} +\usepackage{amsmath} +\usepackage{hyperref} +\usepackage[margin=2cm]{geometry} + +% Document environment: This is where you write the content of your document +\begin{document} + +% Title and author +\title{My Simple LaTeX Document} +\author{Your Name} +\date{\today} +\maketitle + +% Introduction +\section{Introduction} +This is a simple LaTeX document. + +% Math example +\section{Math Example} +The quadratic formula is given by: +$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$ + +% Conclusion +\section{Conclusion} +This is the end of my simple LaTeX document. + +\end{document} +