Files
home-manager/modules/programs/tex-fmt.nix
Austin Horstman 355734d876 treewide: remove literalExpression where unneeded
`literalExpression` is intended just to signify code that needs to stay
a string that gets represented exactly as-is for docs. It has been
misused heavily and people get confused repeatedly on when or not to use
it because of the rampant misuse.
2026-05-17 21:43:25 -05:00

61 lines
1.3 KiB
Nix

{
pkgs,
config,
lib,
...
}:
let
inherit (lib)
mkEnableOption
mkPackageOption
mkOption
;
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" { nullable = true; };
settings = mkOption {
inherit (tomlFormat) type;
default = { };
example = {
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 = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/tex-fmt/tex-fmt.toml" = lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "tex-fmt-config" cfg.settings;
};
};
}