1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-14 04:51:08 +01:00

tldr-update: init (#6401)

Adds `tldr-update` module for enabling automatic `tldr update` on a schedule.
Adds option to `tealdeer` to enable integration with new `tldr-update` module.
This commit is contained in:
Perchun Pak 2025-02-10 15:34:12 +01:00 committed by GitHub
parent 5af1b9a0f1
commit b0bd29bb4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,50 @@
{ 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" ];
};
};
}