From f7552689d8d556edd123b80b2f1c9999d2b7d399 Mon Sep 17 00:00:00 2001 From: William G Underwood <42812654+WGUNDERWOOD@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:56:04 +0000 Subject: [PATCH] tex-fmt: add module tex-fmt is a LaTeX source code formatter written in Rust, and uses a user configuration file in the .toml format. --- modules/modules.nix | 1 + modules/programs/tex-fmt.nix | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 modules/programs/tex-fmt.nix diff --git a/modules/modules.nix b/modules/modules.nix index d7f139333..6774a7701 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -236,6 +236,7 @@ let ./programs/tealdeer.nix ./programs/terminator.nix ./programs/termite.nix + ./programs/tex-fmt.nix ./programs/texlive.nix ./programs/thefuck.nix ./programs/thunderbird.nix diff --git a/modules/programs/tex-fmt.nix b/modules/programs/tex-fmt.nix new file mode 100644 index 000000000..26d9a820e --- /dev/null +++ b/modules/programs/tex-fmt.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.tex-fmt; + configPath = "${config.xdg.configHome}/tex-fmt/tex-fmt.toml"; +in { + meta.maintainers = [ maintainers.wgunderwood ]; + + options = { + programs.tex-fmt = { + enable = mkEnableOption "tex-fmt"; + package = mkPackageOption pkgs "tex-fmt" { }; + options = mkOption { + default = { }; + type = with types; attrsOf (oneOf [ str bool int ]); + description = '' + List of options to pass to tex-fmt. + + See + for an example configuration. + ''; + example = { + usetabs = true; + wraplen = 70; + }; + }; + }; + }; + + config = mkIf cfg.enable { + home = mkMerge [ + { packages = [ cfg.package ]; } + (mkIf (cfg.options != [ ]) { + file."${configPath}".text = lib.concatLines cfg.options; + }) + ]; + }; +}