Declaring a shell environment
You can automatically pull your project's dependencies into your shell by
declaring a shell environment and then activating
it with nix develop or direnv.
Here's an example in a flake using Typix's
devShell:
{
outputs = { typix }: let
system = "x86_64-linux";
typixLib = typix.lib.${system};
watch-script = typixLib.watchTypstProject {/* ... */};
in {
# packages, apps, etc. omitted
devShells.${system}.default = typixLib.devShell {
fontPaths = [/* ... */];
virtualPaths = [/* ... */];
packages = [
watch-script
];
};
};
}
What this example does:
- Fonts added to
fontPathswill be made available totypstcommands via theTYPST_FONT_PATHSenvironment variable. - Files in
virtualPathswill be recursively symlinked to the current directory (only overwriting existing files whenforceVirtualPathsistrue). - For convenience, the
typst-watchscript is added, which will runwatchTypstProject.