mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
`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.
61 lines
1.3 KiB
Nix
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;
|
|
};
|
|
};
|
|
}
|