1
0
Fork 0

Allow custom fonts

This commit is contained in:
Ethan Reece 2025-07-20 05:08:03 -05:00
parent 9d969e08dc
commit 3966e3110b
Signed by: me
GPG key ID: DD8CE04D5D8FF832
2 changed files with 28 additions and 5 deletions

View file

@ -41,6 +41,7 @@
dictionary = [
"Asahi"
"Catppuccin"
"GmbH"
"Haug"
"Laurenz"
"LLMs"
@ -58,12 +59,16 @@
typst = {
enable = true;
entrypoint = "scratch/typst.typ";
fonts = [ pkgs.inter ];
};
};
# https://flake.parts/options/devshell.html
# reuse annotate -c "Ethan Reece <contact@ethanreece.com>" -l LGPL-3.0-or-later -y 2025
devshells.default = {
packages = [ pkgs.forgejo-cli ];
packages = [
pkgs.forgejo-cli
pkgs.typst
];
devshell = {
motd = ''
{202}󱄅 Nix Flake base{reset}

View file

@ -22,10 +22,21 @@
type = lib.types.string;
default = "main.typ";
};
fonts = lib.mkOption {
description = ''
Fonts for Typst.
'';
type = lib.types.listOf lib.types.package;
default = [ ];
};
};
config = lib.mkIf config.languages.typst.enable (
let
tinymistURL = "127.0.0.1:23635";
fonts = pkgs.buildEnv {
name = "fonts";
paths = config.languages.typst.fonts;
};
in
{
languages.en-us.dictionary = [
@ -56,10 +67,17 @@
language-server.tinymist = {
command = "${pkgs.tinymist}/bin/tinymist";
config = {
preview.background.enabled = true;
preview.background.args = [
"--data-plane-host=${tinymistURL}"
"--invert-colors=never"
preview.background = {
enabled = true;
args = [
"--data-plane-host=${tinymistURL}"
"--invert-colors=never"
];
};
typstExtraArgs = [
"--ignore-system-fonts"
"--font-path"
"${fonts}/share/fonts"
];
};
};