Files
home-manager/modules/programs/ttyper.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

51 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkIf
mkOption
;
cfg = config.programs.ttyper;
tomlFormat = pkgs.formats.toml { };
in
{
meta.maintainers = [ lib.maintainers.philocalyst ];
options.programs.ttyper = {
enable = lib.mkEnableOption "ttyper, a terminal-based typing test";
package = lib.mkPackageOption pkgs "ttyper" { nullable = true; };
settings = mkOption {
inherit (tomlFormat) type;
default = { };
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/ttyper/config.toml`.
See <https://github.com/max-niederman/ttyper> for all available options,
including supported languages and theme keys.
'';
example = {
default_language = "english200";
theme = {
border_type = "rounded";
prompt_correct = "green";
prompt_incorrect = "red";
};
};
};
};
config = mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."ttyper/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "ttyper-config.toml" cfg.settings;
};
};
}