1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-21 09:49:39 +01:00
home-manager/modules/programs/tex-fmt.nix
Austin Horstman cba2f9ce95 treewide: reformat nixfmt-rfc-style
Reformat repository using new nixfmt-rfc-style.
2025-04-08 08:50:05 -07:00

63 lines
1.4 KiB
Nix

{
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" { nullable = true; };
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 = 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;
};
};
}