From 3acd7087c983951ed640b92376e8862ce498bf76 Mon Sep 17 00:00:00 2001 From: Ethan Reece Date: Thu, 26 Sep 2024 17:05:19 +0000 Subject: [PATCH] Initial commit --- .gitignore | 14 ++++++++++++++ .guix-channel | 3 +++ .guix/modules/template-package.scm | 27 +++++++++++++++++++++++++++ Justfile | 14 ++++++++++++++ README.md | 9 +++++++++ channels.scm | 18 ++++++++++++++++++ manifest.scm | 6 ++++++ src/document.typ | 1 + 8 files changed, 92 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.typ 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..e9ffda4 --- /dev/null +++ b/.guix/modules/template-package.scm @@ -0,0 +1,27 @@ +(add-to-load-path ".") +(define-module (template-package) + #:use-module (saayix packages typst) + #: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 Typst projects") + (description "Guix template for Typst projects") + (home-page "https://git.sudoer777.dev/me/guix-typst-template") + (license license:expat))) diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..3294ea7 --- /dev/null +++ b/Justfile @@ -0,0 +1,14 @@ +default: + guix time-machine --channels=./channels.scm.lock -- shell --container --emulate-fhs --manifest=./manifest.scm -- sh -c "mkdir -p ./out && typst compile ./src/document.typ ./out/document.pdf --font-path=/usr/share/fonts" + +fonts: + guix time-machine --channels=./channels.scm.lock -- shell --container --emulate-fhs --manifest=./manifest.scm -- typst fonts --font-path=/usr/share/fonts + +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..7d0a665 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Guix Typst 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. Run `just fonts` to show the available fonts. diff --git a/channels.scm b/channels.scm new file mode 100644 index 0000000..f98373c --- /dev/null +++ b/channels.scm @@ -0,0 +1,18 @@ +(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 '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..5df8109 --- /dev/null +++ b/manifest.scm @@ -0,0 +1,6 @@ +(add-to-load-path ".guix/modules") +(use-modules (template-package) + (saayix packages typst) + (gnu packages fontutils)) + +(packages->manifest (list typst fontconfig coreutils)) diff --git a/src/document.typ b/src/document.typ new file mode 100644 index 0000000..f1e87ac --- /dev/null +++ b/src/document.typ @@ -0,0 +1 @@ +This document is located in `src/document.typ`.