Initial commit

main
Ethan Reece 2024-11-22 07:24:59 +00:00
commit c73bebb710
8 changed files with 92 additions and 0 deletions

14
.gitignore vendored 100644
View File

@ -0,0 +1,14 @@
*.eps
*.go
*.log
*.mo
*.pdf
*.png
*.tar.xz
*.tmp
*~
.#*
\#*\#
,*
.DS_Store
out

3
.guix-channel 100644
View File

@ -0,0 +1,3 @@
(channel
(version 0)
(directory ".guix/modules"))

View File

@ -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)))

14
Justfile 100644
View File

@ -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

9
README.md 100644
View File

@ -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.

18
channels.scm 100644
View File

@ -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")))))

6
manifest.scm 100644
View File

@ -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))

1
src/document.typ 100644
View File

@ -0,0 +1 @@
This document is located in `src/document.typ`.