vscode: add options to disable update checks

Update notification popups are annoying when vscode/vscodium is
managed by Home Manager. However, as these settings also require the
configuration to be managed via `userSettings`, they are disabled by
default.
This commit is contained in:
Markus S. Wamser 2022-05-17 22:39:11 +02:00 committed by Robert Helgesson
parent 32fe7d2ebb
commit d3f21617ac
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 69 additions and 8 deletions

View file

@ -1 +1,4 @@
{ vscode-keybindings = ./keybindings.nix; }
{
vscode-keybindings = ./keybindings.nix;
vscode-update-checks = ./update-checks.nix;
}

View file

@ -27,12 +27,17 @@ let
}
];
targetPath = if pkgs.stdenv.hostPlatform.isDarwin then
keybindingsPath = if pkgs.stdenv.hostPlatform.isDarwin then
"Library/Application Support/Code/User/keybindings.json"
else
".config/Code/User/keybindings.json";
expectedJson = pkgs.writeText "expected.json" ''
settingsPath = if pkgs.stdenv.hostPlatform.isDarwin then
"Library/Application Support/Code/User/settings.json"
else
".config/Code/User/settings.json";
expectedKeybindings = pkgs.writeText "expected.json" ''
[
{
"command": "editor.action.clipboardCopyAction",
@ -58,6 +63,7 @@ let
}
]
'';
in {
config = {
programs.vscode = {
@ -67,8 +73,10 @@ in {
};
nmt.script = ''
assertFileExists "home-files/${targetPath}"
assertFileContent "home-files/${targetPath}" "${expectedJson}"
assertFileExists "home-files/${keybindingsPath}"
assertFileContent "home-files/${keybindingsPath}" "${expectedKeybindings}"
assertPathNotExists "home-files/${settingsPath}"
'';
};
}

View file

@ -0,0 +1,29 @@
{ pkgs, ... }:
let
settingsPath = if pkgs.stdenv.hostPlatform.isDarwin then
"Library/Application Support/Code/User/settings.json"
else
".config/Code/User/settings.json";
expectedSettings = pkgs.writeText "settings-expected.json" ''
{
"extensions.autoCheckUpdates": false,
"update.mode": "none"
}
'';
in {
programs.vscode = {
enable = true;
package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; };
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
};
nmt.script = ''
assertFileExists "home-files/${settingsPath}"
assertFileContent "home-files/${settingsPath}" "${expectedSettings}"
'';
}