diff --git a/home/home.nix b/home/home.nix index 5936541..d454e1c 100644 --- a/home/home.nix +++ b/home/home.nix @@ -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 diff --git a/home/programs/vscode/auto-update-extensions.nix b/home/programs/vscode/auto-update-extensions.nix new file mode 100644 index 0000000..892589c --- /dev/null +++ b/home/programs/vscode/auto-update-extensions.nix @@ -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" ]; + }; + }; +} diff --git a/home/programs/vscode.nix b/home/programs/vscode/default.nix similarity index 99% rename from home/programs/vscode.nix rename to home/programs/vscode/default.nix index 6c5e04a..e671ffb 100644 --- a/home/programs/vscode.nix +++ b/home/programs/vscode/default.nix @@ -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}"''; diff --git a/home/programs/vscode-extensions/noop-syslog.c b/home/programs/vscode/extensions/noop-syslog.c similarity index 100% rename from home/programs/vscode-extensions/noop-syslog.c rename to home/programs/vscode/extensions/noop-syslog.c diff --git a/home/programs/vscode-extensions/vsliveshare.nix b/home/programs/vscode/extensions/vsliveshare.nix similarity index 100% rename from home/programs/vscode-extensions/vsliveshare.nix rename to home/programs/vscode/extensions/vsliveshare.nix