Allow custom fonts
This commit is contained in:
parent
9d969e08dc
commit
3966e3110b
2 changed files with 28 additions and 5 deletions
|
|
@ -41,6 +41,7 @@
|
||||||
dictionary = [
|
dictionary = [
|
||||||
"Asahi"
|
"Asahi"
|
||||||
"Catppuccin"
|
"Catppuccin"
|
||||||
|
"GmbH"
|
||||||
"Haug"
|
"Haug"
|
||||||
"Laurenz"
|
"Laurenz"
|
||||||
"LLMs"
|
"LLMs"
|
||||||
|
|
@ -58,12 +59,16 @@
|
||||||
typst = {
|
typst = {
|
||||||
enable = true;
|
enable = true;
|
||||||
entrypoint = "scratch/typst.typ";
|
entrypoint = "scratch/typst.typ";
|
||||||
|
fonts = [ pkgs.inter ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# https://flake.parts/options/devshell.html
|
# https://flake.parts/options/devshell.html
|
||||||
# reuse annotate -c "Ethan Reece <contact@ethanreece.com>" -l LGPL-3.0-or-later -y 2025
|
# reuse annotate -c "Ethan Reece <contact@ethanreece.com>" -l LGPL-3.0-or-later -y 2025
|
||||||
devshells.default = {
|
devshells.default = {
|
||||||
packages = [ pkgs.forgejo-cli ];
|
packages = [
|
||||||
|
pkgs.forgejo-cli
|
||||||
|
pkgs.typst
|
||||||
|
];
|
||||||
devshell = {
|
devshell = {
|
||||||
motd = ''
|
motd = ''
|
||||||
{202} Nix Flake base{reset}
|
{202} Nix Flake base{reset}
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,21 @@
|
||||||
type = lib.types.string;
|
type = lib.types.string;
|
||||||
default = "main.typ";
|
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 (
|
config = lib.mkIf config.languages.typst.enable (
|
||||||
let
|
let
|
||||||
tinymistURL = "127.0.0.1:23635";
|
tinymistURL = "127.0.0.1:23635";
|
||||||
|
fonts = pkgs.buildEnv {
|
||||||
|
name = "fonts";
|
||||||
|
paths = config.languages.typst.fonts;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
languages.en-us.dictionary = [
|
languages.en-us.dictionary = [
|
||||||
|
|
@ -56,12 +67,19 @@
|
||||||
language-server.tinymist = {
|
language-server.tinymist = {
|
||||||
command = "${pkgs.tinymist}/bin/tinymist";
|
command = "${pkgs.tinymist}/bin/tinymist";
|
||||||
config = {
|
config = {
|
||||||
preview.background.enabled = true;
|
preview.background = {
|
||||||
preview.background.args = [
|
enabled = true;
|
||||||
|
args = [
|
||||||
"--data-plane-host=${tinymistURL}"
|
"--data-plane-host=${tinymistURL}"
|
||||||
"--invert-colors=never"
|
"--invert-colors=never"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
typstExtraArgs = [
|
||||||
|
"--ignore-system-fonts"
|
||||||
|
"--font-path"
|
||||||
|
"${fonts}/share/fonts"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
treefmt.programs.typstyle.enable = true;
|
treefmt.programs.typstyle.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue