1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/modules/services/tldr-update.nix
Austin Horstman 86402a17b6 treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce
conflicts with other PRs.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-23 16:20:26 -05:00

57 lines
1.1 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.tldr-update;
in
{
meta.maintainers = [ lib.maintainers.perchun ];
options.services.tldr-update = {
enable = lib.mkEnableOption ''
Automatic updates for the tldr CLI
'';
package = lib.mkPackageOption pkgs "tldr" { example = "tlrc"; };
period = lib.mkOption {
type = lib.types.str;
default = "weekly";
description = ''
Systemd timer period to create for scheduled {command}`tldr --update`.
The format is described in {manpage}`systemd.time(7)`.
'';
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.tldr-update = {
Unit = {
Description = "Update tldr CLI cache";
Documentation = "https://tldr.sh/";
};
Service = {
Type = "oneshot";
ExecStart = ''
${lib.getExe cfg.package} --update
'';
};
};
systemd.user.timers.tldr-update = {
Unit.Description = "Update tldr CLI cache";
Timer = {
OnCalendar = cfg.period;
Persistent = true;
};
Install.WantedBy = [ "timers.target" ];
};
};
}