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.
51 lines
1.2 KiB
Nix
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;
|
|
};
|
|
};
|
|
}
|