tealdeer: add module (#2928)

This commit is contained in:
Mario Rodas 2022-05-01 09:27:04 -05:00 committed by GitHub
parent df6010551d
commit 26858fc0db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -245,6 +245,8 @@
/modules/programs/starship.nix @marsam
/modules/programs/tealdeer.nix @marsam
/modules/programs/terminator.nix @chisui
/modules/programs/texlive.nix @rycee

View file

@ -149,6 +149,7 @@ let
./programs/ssh.nix
./programs/starship.nix
./programs/taskwarrior.nix
./programs/tealdeer.nix
./programs/terminator.nix
./programs/termite.nix
./programs/texlive.nix

View file

@ -0,0 +1,53 @@
{ 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 {
meta.maintainers = [ maintainers.marsam ];
options.programs.tealdeer = {
enable = mkEnableOption "Tealdeer";
settings = mkOption {
type = tomlFormat.type;
default = { };
defaultText = literalExpression "{ }";
example = literalExpression ''
{
display = {
compact = false;
use_pager = true;
};
updates = {
auto_update = false;
};
};
'';
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/tealdeer/config.toml</filename> on Linux or
<filename>$HOME/Library/Application Support/tealdeer/config.toml</filename>
on Darwin. See
<link xlink:href="https://dbrgn.github.io/tealdeer/config.html"/>
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;
};
};
}