Skip to content

typst-full: Typst environment with a full set of Typst packages #421686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cherrypiejam
Copy link
Member

Things done

This PR adds a new package typst-full to instantiate a typst environment with a full set of Typst packages from Typst Universe.

The main reason here to make it a separate package is to integrate typst packages update into nixpkgs CI and have a more or less meaningful version number to represent changes of the typst package set.

This PR is tested with nix-shell maintainers/scripts/update.nix --argstr package typst-full --argstr commit true, and the update can be correctly committed on the current branch. However, based on the past experience, it doesn't necessarily imply r-ryantm would correctly commit the update. Also please let me know if there's a better way to approach this.

@emaryn @drupol

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@cherrypiejam
Copy link
Member Author

If create such a package just for automatic updates, I subjectively think it is not necessary and there is no need to solve the problem.

Defining it in a separate package directory is currently just for the CI thing --- as it requires a different way of versioning and a dedicated update script (maybe there's a better way to structure this tho). However, I would argue there are more benefits to provide a typst environment with the full package set. This is similar to texliveFull package which precludes every TeX Live package, which is convenient for people who just want to compile their Typst docs with Nix without manually specifying a set of dependent packages. Additionally it makes sure that every typstPackage is instantiatable, as it is checked by the CI and depends on every Typst package.

Also I would like to make typstPackages a reliable and relatively up-to-date source for Typst packages, so that other tools (e.g., Typix https://github.com/loqusion/typix) would make better use of them.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Jul 3, 2025
builtins.hashFile "sha256" ../typst/typst-packages-from-universe.toml
);
typstFull = typst.withPackages (p: builtins.attrValues p);
updateTypstFull = writeShellScript "update-typst-full.sh" ''
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, fixed. Need to borrow some code from the common updater bc it requires hash to be defined in the nix file where this nix derivation doesn't have its own src/hash defined

in
stdenv.mkDerivation (finalAttrs: {
pname = "typst-full";
version = "${typst.version}.${packageSetVersion}";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, mind letting me know why 0-unstable as a prefix?

@cherrypiejam
Copy link
Member Author

Is there a way to override the attribute name from typst-full to typstFull?

@cherrypiejam cherrypiejam requested a review from a user July 10, 2025 02:35
@ghost ghost removed their request for review July 11, 2025 21:03
@cherrypiejam cherrypiejam requested a review from drupol July 12, 2025 22:49
@RossSmyth
Copy link
Contributor

I don't quite understand the full reasoning for this PR.

The main reason here to make it a separate package is to integrate typst packages update into nixpkgs CI and have a more or less meaningful version number to represent changes of the typst package set.

But they are already evaled by Hydra, so I'm not quite sure what else this adds.

Are you trying to have a package that represents the version of the Universe repo as a whole? I don't understand the point of that either though if so. No one really cares what the version of the Universe repo is.

I can understand the value in a typstFull package, but I would just make it

https://github.com/NixOS/nixpkgs/blob/fcef3397ff17a1be2a86a0298e63092e9b051c45/pkgs/by-name/ty/typst-full/package.nix#L9-L16

those lines and nothing else.

@cherrypiejam
Copy link
Member Author

But they are already evaled by Hydra, so I'm not quite sure what else this adds.

Are they? Specifically I am talking about updating typst-packages-from-universe.toml with CI. From my understanding the CI (nixpkgs-update) only supports automatic update script for a single package, not for a group of packages such as this case. Integrating the Typst packages update script into the typst package requires changing its version number. Otherwise the CI would ignore the update. This PR essentially is a workaround to this issue by creating an dedicated typst-full package, and its version number reflects something about the Typst packages (I agree that nobody cares the version number, but the CI does). Plus the typst-full is useful, so it makes sense to have this in nixpkgs.

If the update script is integrated by Hydra, so far I didn't not see any automatic commit to update the meta file of Typst packages

@cherrypiejam
Copy link
Member Author

@RossSmyth @drupol Any followup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants