home/vscode: move extension update timer to separate module
Evaluate machine configurations / eval (xps16) (push) Successful in 2m15s
Evaluate machine configurations / eval (kasei) (push) Successful in 2m37s
Evaluate machine configurations / eval (tsuki) (push) Successful in 2m49s

This commit is contained in:
2026-06-06 19:38:23 +09:00
parent fda7bc1e5a
commit 41ff34aead
4 changed files with 53 additions and 39 deletions
@@ -0,0 +1,50 @@
{ config, lib, ... }:
let
cfg = config.programs.vscode;
in
{
options.programs.vscode.autoUpdateExtensions = {
enable = lib.mkEnableOption "" // {
description = "Whether to automatically update mutably installed vscode extensions.";
};
onCalendar = lib.mkOption {
type = lib.types.str;
default = "daily";
example = "weekly";
# TODO: link to systemd manpage for format.
description = "How often to update the database.";
};
};
config = lib.mkIf (cfg.enable && cfg.autoUpdateExtensions.enable) {
systemd.user.services.update-vscode-extensions = {
Unit = {
Description = "Update vscode extensions";
};
Service = {
Type = "oneshot";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${lib.getExe cfg.package} --update-extensions";
};
};
systemd.user.timers.update-vscode-extensions = {
Unit = {
Description = "Update vscode extensions";
};
Timer = {
Unit = "update-vscode-extensions.service";
OnCalendar = cfg.autoUpdateExtensions.onCalendar;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
};
}