mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-16 14:01:08 +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:
parent
8b629b5424
commit
9556d3c2b4
7 changed files with 114 additions and 0 deletions
|
|
@ -2148,6 +2148,15 @@ in {
|
||||||
under '$XDG_CONFIG_HOME/easyeffects/{input,output}/'.
|
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.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,7 @@ let
|
||||||
./programs/tealdeer.nix
|
./programs/tealdeer.nix
|
||||||
./programs/terminator.nix
|
./programs/terminator.nix
|
||||||
./programs/termite.nix
|
./programs/termite.nix
|
||||||
|
./programs/tex-fmt.nix
|
||||||
./programs/texlive.nix
|
./programs/texlive.nix
|
||||||
./programs/thefuck.nix
|
./programs/thefuck.nix
|
||||||
./programs/thunderbird.nix
|
./programs/thunderbird.nix
|
||||||
|
|
|
||||||
53
modules/programs/tex-fmt.nix
Normal file
53
modules/programs/tex-fmt.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -384,6 +384,7 @@ in import nmtSrc {
|
||||||
./modules/programs/starship
|
./modules/programs/starship
|
||||||
./modules/programs/taskwarrior
|
./modules/programs/taskwarrior
|
||||||
./modules/programs/tealdeer
|
./modules/programs/tealdeer
|
||||||
|
./modules/programs/tex-fmt
|
||||||
./modules/programs/texlive
|
./modules/programs/texlive
|
||||||
./modules/programs/thefuck
|
./modules/programs/thefuck
|
||||||
./modules/programs/thunderbird
|
./modules/programs/thunderbird
|
||||||
|
|
|
||||||
31
tests/modules/programs/tex-fmt/custom-settings.nix
Normal file
31
tests/modules/programs/tex-fmt/custom-settings.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
config = {
|
||||||
|
programs.tex-fmt = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
wrap = true;
|
||||||
|
tabsize = 2;
|
||||||
|
tabchar = "space";
|
||||||
|
lists = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = let
|
||||||
|
expectedConfDir = if pkgs.stdenv.isDarwin then
|
||||||
|
"Library/Application Support"
|
||||||
|
else
|
||||||
|
".config";
|
||||||
|
expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml";
|
||||||
|
in ''
|
||||||
|
assertFileExists "${expectedConfigPath}"
|
||||||
|
assertFileContent "${expectedConfigPath}" ${
|
||||||
|
pkgs.writeText "tex-fmt.config-custom.expected" ''
|
||||||
|
lists = []
|
||||||
|
tabchar = "space"
|
||||||
|
tabsize = 2
|
||||||
|
wrap = true
|
||||||
|
''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
15
tests/modules/programs/tex-fmt/default-settings.nix
Normal file
15
tests/modules/programs/tex-fmt/default-settings.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
config = {
|
||||||
|
programs.tex-fmt = { enable = true; };
|
||||||
|
|
||||||
|
nmt.script = let
|
||||||
|
expectedConfDir = if pkgs.stdenv.isDarwin then
|
||||||
|
"Library/Application Support"
|
||||||
|
else
|
||||||
|
".config";
|
||||||
|
expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml";
|
||||||
|
in ''
|
||||||
|
assertPathNotExists "${expectedConfigPath}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
4
tests/modules/programs/tex-fmt/default.nix
Normal file
4
tests/modules/programs/tex-fmt/default.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
tex-fmt-default-settings = ./default-settings.nix;
|
||||||
|
tex-fmt-custom-settings = ./custom-settings.nix;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue