From 26858fc0dbed71fa0609490fc2f2643e0d175328 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 1 May 2022 09:27:04 -0500 Subject: [PATCH] tealdeer: add module (#2928) --- .github/CODEOWNERS | 2 ++ modules/modules.nix | 1 + modules/programs/tealdeer.nix | 53 +++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 modules/programs/tealdeer.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 43ed4e4c..c282d2ac 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -245,6 +245,8 @@ /modules/programs/starship.nix @marsam +/modules/programs/tealdeer.nix @marsam + /modules/programs/terminator.nix @chisui /modules/programs/texlive.nix @rycee diff --git a/modules/modules.nix b/modules/modules.nix index 462575f4..91e1654d 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -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 diff --git a/modules/programs/tealdeer.nix b/modules/programs/tealdeer.nix new file mode 100644 index 00000000..98ef4d2c --- /dev/null +++ b/modules/programs/tealdeer.nix @@ -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 + $XDG_CONFIG_HOME/tealdeer/config.toml on Linux or + $HOME/Library/Application Support/tealdeer/config.toml + on Darwin. See + + 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; + }; + }; +}