1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-15 21:41:09 +01:00

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.
This commit is contained in:
William G Underwood 2024-12-30 21:56:04 +00:00 committed by Austin Horstman
parent 8b629b5424
commit 9556d3c2b4
7 changed files with 114 additions and 0 deletions

View file

@ -2148,6 +2148,15 @@ in {
under '$XDG_CONFIG_HOME/easyeffects/{input,output}/'.
'';
}
{
time = "2025-02-12T15:56:00+00:00";
message = ''
A new module is available: 'programs.tex-fmt'.
tex-fmt is a LaTeX formatter written in Rust.
See https://github.com/WGUNDERWOOD/tex-fmt for more information.
'';
}
];
};
}

View file

@ -246,6 +246,7 @@ let
./programs/tealdeer.nix
./programs/terminator.nix
./programs/termite.nix
./programs/tex-fmt.nix
./programs/texlive.nix
./programs/thefuck.nix
./programs/thunderbird.nix

View file

@ -0,0 +1,53 @@
{ pkgs, config, lib, ... }:
let
inherit (lib) mkEnableOption mkPackageOption mkOption literalExpression;
configDir = if pkgs.stdenv.isDarwin then
"Library/Application Support"
else
config.xdg.configHome;
tomlFormat = pkgs.formats.toml { };
cfg = config.programs.tex-fmt;
in {
meta.maintainers = with lib.maintainers; [ mirkolenz wgunderwood ];
options.programs.tex-fmt = {
enable = mkEnableOption "tex-fmt";
package = mkPackageOption pkgs "tex-fmt" { };
settings = mkOption {
type = tomlFormat.type;
default = { };
example = literalExpression ''
{
wrap = true;
tabsize = 2;
tabchar = "space";
lists = [];
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/tex-fmt/tex-fmt.toml` on Linux or
{file}`$HOME/Library/Application Support/tex-fmt/tex-fmt.toml` on Darwin.
See <https://github.com/WGUNDERWOOD/tex-fmt> and
<https://github.com/WGUNDERWOOD/tex-fmt/blob/master/tex-fmt.toml>
for more information.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file."${configDir}/tex-fmt/tex-fmt.toml" =
lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "tex-fmt-config" cfg.settings;
};
};
}