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
+1
View File
@@ -167,6 +167,7 @@
prism-launcher = ./home/modules/programs/prism-launcher;
shellAliases = ./home/modules/shellAliases.nix;
systemd-tmpfiles = ./home/modules/systemd-tmpfiles.nix;
vscode-auto-extension-updater = ./home/modules/programs/vscode/auto-extension-updater.nix;
};
homeConfigurations = {
@@ -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" ];
};
};
};
}
@@ -1,35 +0,0 @@
{ config, lib, ... }:
let
cfg = config.programs.vscode;
in
lib.mkIf cfg.enable {
# TODO: add `dirname` to $PATH upstream
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 = "daily";
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
}
+2 -4
View File
@@ -3,10 +3,6 @@ let
cfg = config.programs.vscode;
in
{
imports = [
./auto-update-extensions.nix
];
# home.file = let
# configDir = {
# "vscode" = "Code";
@@ -33,6 +29,8 @@ in
'';
});
autoUpdateExtensions.enable = true;
profiles.default = {
userSettings = let
mapPrefixToSet = prefix: set: