From 822d857ba913e48661faba0ac7cf5f4b69d70499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Sat, 22 Nov 2025 02:04:44 -0700 Subject: [PATCH] feat(emacs): configure plex in a package --- modules/home/users/msyds/emacs.nix | 1 + .../home/users/msyds/emacs/nix/plex-latex.nix | 42 +++++++++++++++---- .../msyds/emacs/nix/plex-latex/syd-plex.sty | 11 +++++ 3 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 modules/home/users/msyds/emacs/nix/plex-latex/syd-plex.sty diff --git a/modules/home/users/msyds/emacs.nix b/modules/home/users/msyds/emacs.nix index 83dbbe6..2b98f52 100644 --- a/modules/home/users/msyds/emacs.nix +++ b/modules/home/users/msyds/emacs.nix @@ -19,6 +19,7 @@ in { imports = [ ./emacs/nix/jinx.nix ./emacs/nix/tufte-latex.nix + ./emacs/nix/plex-latex.nix ]; config = lib.mkIf cfg.enable { diff --git a/modules/home/users/msyds/emacs/nix/plex-latex.nix b/modules/home/users/msyds/emacs/nix/plex-latex.nix index de75f7e..eb4e262 100644 --- a/modules/home/users/msyds/emacs/nix/plex-latex.nix +++ b/modules/home/users/msyds/emacs/nix/plex-latex.nix @@ -7,14 +7,40 @@ in { }; config = lib.mkIf cfg.enable { - sydnix.emacs.tex.extraTexPackages = { - inherit (pkgs.texlive) - plex - plex-otf - fontaxes - unicode-math - xetex + sydnix.emacs.tex.extraTexPackages = + let syd-plex = pkgs.stdenvNoCC.mkDerivation (final: { + pname = "syd-plex-latex"; + version = "1.0.0"; + src = ./plex-latex; + nativeBuildInputs = [ pkgs.texlive.combined.scheme-small ]; + passthru = { + pkgs = [ final.finalPackage ]; + tlDeps = with pkgs.texlive; [ + plex + plex-otf + fontaxes + unicode-math + xetex + ]; + tlType = "run"; + }; + installPhase = '' + runHook preInstall + dir="$out/tex/latex/syd-plex" + mkdir -p "$dir" + mv syd-plex.sty "$dir" + runHook postInstall + ''; + }); + in { + inherit syd-plex; + inherit (pkgs.texlive) + plex + plex-otf + fontaxes + unicode-math + xetex ; - }; + }; }; } diff --git a/modules/home/users/msyds/emacs/nix/plex-latex/syd-plex.sty b/modules/home/users/msyds/emacs/nix/plex-latex/syd-plex.sty new file mode 100644 index 0000000..f76d2ef --- /dev/null +++ b/modules/home/users/msyds/emacs/nix/plex-latex/syd-plex.sty @@ -0,0 +1,11 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{syd-plex}[2014/08/24 Configure IBM Plex fonts] +Example LaTeX package + +% Redefine some commands to make unicode-math work lol. See ยง3.1 of the +% unicode-math manual. +\renewcommand*{\mathrm}[1]{\symup{#1}} + +\RequirePackage{plex-otf} +\setmathfont{IBM Plex Math} +\setmainfont{IBM Plex Serif}