From 0732d1a763a9f3b2dde37ee8d0396cd133ab9185 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Thu, 29 May 2025 01:09:43 +0200 Subject: [PATCH] build: Experiment with fontconfig --- flake.nix | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 722b1b2..f1c38ea 100644 --- a/flake.nix +++ b/flake.nix @@ -10,17 +10,17 @@ }; }; - outputs = - { nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem ( - system: + outputs = { self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - tex = (pkgs.texlive.combine { - inherit (pkgs.texlive) - scheme-basic + pkgs = import nixpkgs { inherit system; }; + + tex = pkgs.texlive.combine { + inherit (pkgs.texlive.pkgs) xetex xetexref + scheme-minimal + mathtools enumitem ragged2e geometry @@ -43,21 +43,50 @@ hyperref bookmark ; - }); + }; + src = ./.; nativeBuildInputs = with pkgs; [ coreutils bashInteractive gnumake tex + line-awesome + fontconfig + poppler-utils # for pdffonts ]; - buildInputs = with pkgs; [ + buildInputs = with pkgs; [ ]; + systemfontdirs = with pkgs; map toString [ + line-awesome ]; + + # used by xetex and mtx-fonts (context) + generatedFontsConf = pkgs.makeFontsConf { + fontDirectories = systemfontdirs ++ [ tex.fonts ]; + }; + + customFontConf = pkgs.writeText "custom-fonts.conf" '' + + + + ''; + + fontsConf = pkgs.writeText "fonts.conf" '' + + + + ${customFontConf} + ${generatedFontsConf} + /etc/fonts/fonts.conf + + ''; + + FONTCONFIG_FILE = fontsConf; in { devShells.default = pkgs.mkShellNoCC { - inherit buildInputs nativeBuildInputs; + inherit buildInputs nativeBuildInputs FONTCONFIG_FILE; }; } );