Skip to content

Releases: RossSmyth/press

v2.1: Support input flags and devShell tooling

27 May 19:14
Compare
Choose a tag to compare

Previously, when using a devShell, Tinymist would fail to find the packages and fonts that are used. This is because the fonts and packages are registered with environment variables in a wrapper. Now these are exposed with a shellHook, so the devShell should properly pick up these environment variables as well now.

Changes

  • Expose TYPST_PACKAGE_CACHE_PATH (Typst Universe dependencies), TYPST_PACKAGE_PATH (custom dependencies), and TYPST_FONT_PATHS (fonts) to the devShell
  • Support input arguments

Key-value arguments on the CLI provided with --input key=value
https://typst.app/docs/reference/foundations/sys/

buildTypstDocument {
    name = "inputs";
    src = ./.;
    inputs = {
      language = "en";
      name = "John Doe";
    };
  };
Value of "sys.inputs.language" is #sys.inputs.language

#if sys.inputs.name != "John Doe" {
  panic("Expected 'John Doe' in 'sys.inputs.name' but got " + sys.inputs.flag)
}

Huge shout-out to @jbgi for doing most of the legwork for both of these changes!

v2.0: Nixpkgs typstPackages support

29 Apr 21:21
Compare
Choose a tag to compare

Recently, Nixpkgs merged all packages in Typst Universe into the repo.

This is very convenient for me because that means that rather than pulling in the entire Universe repo, the user can not specify what exactly they would like. So here it is

Changes:

  1. No longer vendor Typst Universe into the nix store for every document
    Documents should build much faster now.
  2. [Breaking] Remove unused or deprecated attributes
    typstPatches, typstUniverse, and universePatches
  3. Add verbose attribute
    Controls how verbose the Typst compiler session is
  4. Add nice assert messages
  5. [Breaking] Remove support for all the different datatypes for the extraPackages key.
    It used to accept a value, a list, an attributeset of values, and an attribute set of lists. Now it only accepts an attribute set of lists.

See the template for full details, but essentially it looks like this now:

pkgs.buildTypstDocument {
    name = "foo";
    src = ./.;
    typstEnv = p: [ p.note-me ];
}

Regressions:
This package does not scan the custom packages pulled in. This means that if you use a custom package that relies on having a Universe package that is not added to typstEnv, compilation will fail. Tracked in #10

v1.4: devShell support

10 Apr 05:31
Compare
Choose a tag to compare

Per the discussion in #7 support for devShells has been added. Thanks @augu5te!

  1. Internally, rather than setting up the environment in the build shell, it now creates a wrapper around Typst. This wrapper is added to the environment when a shell is created 903728d
  2. A devShell was added to the template b2c2107

Minor:

  1. Added test to ensure normals FODs will always work c7465f9
  2. Switched to nixpkgs-fmt from Alejandra 67cb7c0
  3. Deprecated the typstPatches attribute

v1.3.1: Fix extraPackages failing with fetchTree output

17 Mar 15:51
Compare
Choose a tag to compare

My tests used fetchFromGitHub. Which is one way to receive a FOD. But flakes internally use fetchTree. But when you use flake = false, it turns out the output is not actually a derivation. And since my code checked to see if it was a derivation, it failed and attempted to use it as an attrset. This is quite goofy. But a hack is implemented, I'm unsure if it is canonical or not. But it now works and is tested as intended.

v1.3: Supports more types of extraPackages input

17 Mar 00:36
Compare
Choose a tag to compare

the extraPackages attribute on now supports more input types:

Lists of packages. The namespace defaults to "local"

  gitImportList = buildTypstDocument (self: {
    name = "gitImport";
    src = ./documents;
    file = "gitImport.typ";
    extraPackages = [note-me];
  });

A string store path to a package. Namespace is "local".

  gitImportString = buildTypstDocument (self: {
    name = "gitImport";
    src = ./documents;
    file = "gitImport.typ";
    extraPackages = "${note-me}";
  });

A package derivation. Namespace is "local".

  gitImportDrv = buildTypstDocument (self: {
    name = "gitImport";
    src = ./documents;
    file = "gitImport.typ";
    extraPackages = note-me;
  });

A (store) path. Namespace is "local".

  gitImportDrv = buildTypstDocument (self: {
    name = "gitImport";
    src = ./documents;
    file = "gitImport.typ";
    extraPackages = ./noteMe;
  });

An attribute set with namespace keys and individual packages as the values.

  gitImportAttrStr = buildTypstDocument (self: {
    name = "gitImport";
    src = ./documents;
    file = "gitImport.typ";
    extraPackages = {
      local = "${note-me}";
      myName = note-me;
      anotherName = ./noteMe;
    };
  });

1.2.1: Fix HTML format output

16 Mar 22:29
Compare
Choose a tag to compare

It was broken before as I never tested it. Now it Just Works:tm:

1.2: Patching Typst Universe packages

16 Mar 20:58
Compare
Choose a tag to compare

Can now patch Typst Universe.

The derivation:

  patchUni = buildTypstDocument (self: {
    name = "patchUni";
    src = ./documents;
    file = "patchUni.typ";
    universePatches = [
      ./universe.patch
    ];
  });

The patch:

--- a/packages/preview/note-me/0.5.0/lib.typ
+++ b/packages/preview/note-me/0.5.0/lib.typ
@@ -1,2 +1,2 @@
-#import "note-me.typ": admonition, note, tip, important, warning, caution
-#import "note-me-more.typ": todo
\ No newline at end of file
+#import "note-me.typ": admonition, bote, tip, important, warning, caution
+#import "note-me-more.typ": todo
--- a/packages/preview/note-me/0.5.0/note-me.typ
+++ b/packages/preview/note-me/0.5.0/note-me.typ
@@ -80,7 +80,7 @@
   ],
 )
 
-#let note(title: "Note", children) = admonition(
+#let bote(title: "Note", children) = admonition(
   icon-path: "icons/info.svg",
   title: title,
   color: rgb(9, 105, 218),

The document:

#import "@preview/note-me:0.5.0": bote

#bote[
  Success!
]

Minor: Fixed template syntax mistake and added test for patching the document itself.

1.1: Font support

16 Mar 01:30
Compare
Choose a tag to compare
  • Support arbitrary fonts
  fonts = buildTypstDocument (self: {
    name = "fonts";
    src = ./documents;
    file = "fonts.typ";
    fonts = [
      fira-code
      inconsolata
    ];
  });

v1.0

15 Mar 01:50
Compare
Choose a tag to compare

Initial release.