Hi,
I tried to manage my VSCode completely with Home-Manager, including settings, extensions and extension settings. This is the config I’m currently using:
{ pkgs, ... }: {
imports = [
./python-dev.nix
];
home-manager.users.mentos.programs.vscode = {
enable = true;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
mutableExtensionsDir = false;
# Extensions
extensions = (with pkgs.vscode-extensions; [
# Stable
ms-vscode-remote.remote-ssh
mhutchie.git-graph
pkief.material-icon-theme
oderwat.indent-rainbow
bierner.markdown-emoji
bierner.emojisense
jnoortheen.nix-ide
]) ++ (with pkgs.unstable.vscode-extensions; [
# Unstable
seatonjiang.gitmoji-vscode
]);
# Settings
userSettings = {
# General
"editor.fontSize" = 16;
"editor.fontFamily" = "'Jetbrains Mono', 'monospace', monospace";
"terminal.integrated.fontSize" = 14;
"terminal.integrated.fontFamily" = "'JetBrainsMono Nerd Font', 'monospace', monospace";
"window.zoomLevel" = 1;
"editor.multiCursorModifier" = "ctrlCmd";
"workbench.startupEditor" = "none";
"explorer.compactFolders" = false;
# Whitespace
"files.trimTrailingWhitespace" = true;
"files.trimFinalNewlines" = true;
"files.insertFinalNewline" = true;
"diffEditor.ignoreTrimWhitespace" = false;
# Git
"git.enableCommitSigning" = true;
"git-graph.repository.sign.commits" = true;
"git-graph.repository.sign.tags" = true;
"git-graph.repository.commits.showSignatureStatus" = true;
# Styling
"window.autoDetectColorScheme" = true;
"workbench.preferredDarkColorTheme" = "Default Dark Modern";
"workbench.preferredLightColorTheme" = "Default Light Modern";
"workbench.iconTheme" = "material-icon-theme";
"material-icon-theme.activeIconPack" = "none";
"material-icon-theme.folders.theme" = "classic";
# Other
"telemetry.telemetryLevel" = "off";
"update.showReleaseNotes" = false;
# Gitmoji
"gitmoji.onlyUseCustomEmoji" = true;
"gitmoji.addCustomEmoji" = [
{
"emoji" = "📦 NEW:";
"code" = ":package: NEW:";
"description" = "... Add new code/feature";
}
{
"emoji" = "👌 IMPROVE:";
"code" = ":ok_hand: IMPROVE:";
"description" = "... Improve existing code/feature";
}
{
"emoji" = "❌ REMOVE:";
"code" = ":x: REMOVE:";
"description" = "... Remove existing code/feature";
}
{
"emoji" = "🐛 FIX:";
"code" = ":bug: FIX:";
"description" = "... Fix a bug";
}
{
"emoji" = "📑 DOC:";
"code" = ":bookmark_tabs: DOC:";
"description" = "... Anything related to documentation";
}
{
"emoji" = "🤖 TEST:";
"code" = ":robot: TEST:";
"description" = "... Anything realted to tests";
}
];
};
# Keybindings
keybindings = [
{
key = "ctrl+y";
command = "editor.action.commentLine";
when = "editorTextFocus && !editorReadonly";
}
{
key = "ctrl+shift+7";
command = "-editor.action.commentLine";
when = "editorTextFocus && !editorReadonly";
}
{
key = "ctrl+d";
command = "workbench.action.toggleSidebarVisibility";
}
{
key = "ctrl+b";
command = "-workbench.action.toggleSidebarVisibility";
}
];
};
environment.persistence."/persist".users.mentos.directories = [ ".config/Code" ];
}
I’ve set mutableExtensionsDir = false;
because that sounds like I want when building reproducible system. Unfortunately this leads to the following issue:
The setting "material-icon-theme.folders.theme" = "classic";
gets picked up by VSCode and shows the correct value in the GUI. But the folder icons in the sidebar are not affected by this setting (while they should).
When setting mutableExtensionsDir = true;
there is the same issue, but with an addition: When going to the extensions section in the VSCode GUI, under each extension there is a button saying “window reload required”. If I do that, the setting does get picked up by the extension and the sidebar icons change accordingly. So I get the desired result - with an additional step - at the cost of not being immutable anymore. This button does not show up with mutableExtensionsDir = false;
While this is just a cosmetical and not so important setting, I also observed the same behavior with some settings regarding my Python lsp config - which is not tolerable.
Why exactly is that the case? Why does the extension dir need to be mutable for extensions to pick up their settings correctly?
Anyone noticed the same problem? And maybe found a better solution/workaround for this?