2022-05-01 16:27:04 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.tealdeer;
|
|
|
|
|
|
|
|
tomlFormat = pkgs.formats.toml { };
|
|
|
|
|
|
|
|
configDir = if pkgs.stdenv.isDarwin then
|
|
|
|
"Library/Application Support"
|
|
|
|
else
|
|
|
|
config.xdg.configHome;
|
|
|
|
|
|
|
|
in {
|
2023-06-22 10:16:28 +02:00
|
|
|
meta.maintainers = [ ];
|
2022-05-01 16:27:04 +02:00
|
|
|
|
|
|
|
options.programs.tealdeer = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "Tealdeer";
|
2022-05-01 16:27:04 +02:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = tomlFormat.type;
|
|
|
|
default = { };
|
|
|
|
defaultText = literalExpression "{ }";
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
display = {
|
|
|
|
compact = false;
|
|
|
|
use_pager = true;
|
|
|
|
};
|
|
|
|
updates = {
|
|
|
|
auto_update = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-05-01 16:27:04 +02:00
|
|
|
Configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/tealdeer/config.toml` on Linux or
|
|
|
|
{file}`$HOME/Library/Application Support/tealdeer/config.toml`
|
2022-05-01 16:27:04 +02:00
|
|
|
on Darwin. See
|
2023-07-01 01:30:13 +02:00
|
|
|
<https://dbrgn.github.io/tealdeer/config.html>
|
2022-05-01 16:27:04 +02:00
|
|
|
for more information.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ pkgs.tealdeer ];
|
|
|
|
|
|
|
|
home.file."${configDir}/tealdeer/config.toml" = mkIf (cfg.settings != { }) {
|
|
|
|
source = tomlFormat.generate "tealdeer-config" cfg.settings;
|
|
|
|
};
|
2024-01-24 08:21:24 +01:00
|
|
|
|
|
|
|
home.activation.tealdeerCache = hm.dag.entryAfter [ "linkGeneration" ] ''
|
|
|
|
$VERBOSE_ECHO "Rebuilding tealdeer cache"
|
|
|
|
$DRY_RUN_CMD ${getExe pkgs.tealdeer} --update
|
|
|
|
'';
|
2022-05-01 16:27:04 +02:00
|
|
|
};
|
|
|
|
}
|