home/vscode: add timer for extension updates

This commit is contained in:
Oystein Kristoffer Tveit 2024-08-12 17:36:13 +02:00
parent dbea006c50
commit dfc0a3728d
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
5 changed files with 41 additions and 1 deletions

View File

@ -39,7 +39,7 @@ in {
./programs/qutebrowser.nix
./programs/rofi.nix
./programs/taskwarrior.nix
./programs/vscode.nix
./programs/vscode
# ./programs/xmobar
./programs/xmonad
./programs/zathura.nix

View File

@ -0,0 +1,35 @@
{ config, lib, ... }:
let
cfg = config.programs.vscode;
in
{
# 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" ];
};
};
}

View File

@ -14,6 +14,11 @@ let
configFilePath = "${userDir}/settings.json";
in
{
imports = [
./auto-update-extensions.nix
# ./extensions
];
home.file.${configFilePath} = {
target = "${configFilePath}.ro";
onChange = ''install -m660 $(realpath "${configFilePath}.ro") "${configFilePath}"'';