From c06394b9fe8f5b700254be5d316a6bdd39fae40b Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Wed, 4 Dec 2024 13:28:30 -0700 Subject: [PATCH] VSCode config refactor + save as root extension + .hujson = jsonc --- home-manager/modules/vscode.nix | 50 ++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/home-manager/modules/vscode.nix b/home-manager/modules/vscode.nix index b64a13b..97d1f21 100644 --- a/home-manager/modules/vscode.nix +++ b/home-manager/modules/vscode.nix @@ -1,33 +1,51 @@ { pkgs, inputs, system, ... }: { - programs.vscode = { + programs.vscode = let vscode-package = pkgs.vscodium; in { enable = true; - package = pkgs.vscodium; + package = vscode-package; enableUpdateCheck = false; enableExtensionUpdateCheck = false; mutableExtensionsDir = false; - extensions = with inputs.vscode-extensions.extensions."${system}".open-vsx; [ - # Language support - rust-lang.rust-analyzer # Rust - llvm-vs-code-extensions.vscode-clangd # C++ - vadimcn.vscode-lldb # C++ Debugging - jnoortheen.nix-ide # Nix - tamasfe.even-better-toml # TOML - yzhang.markdown-all-in-one # Markdown - denoland.vscode-deno # Deno JS/TS - # Theming - pkief.material-icon-theme # Material icons - # Utilities - streetsidesoftware.code-spell-checker # Spellchecking - ]; + extensions = with (inputs.vscode-extensions.extensions."${system}".forVSCodeVersion ( + # Get pkgs.vscodium version, and remove the 4th part (forVSCodeVersion only expects 3 parts) + # By using forVSCodeVersion, any unsupported versions are automatically excluded and this config + # won't build (rather than only finding out in vscode itself) + pkgs.lib.strings.concatStringsSep "." ( + pkgs.lib.lists.take 3 ( + pkgs.lib.strings.splitString "." vscode-package.version + ) + ) + )); ( + (with open-vsx; [ + # Language support + rust-lang.rust-analyzer # Rust + llvm-vs-code-extensions.vscode-clangd # C++ + vadimcn.vscode-lldb # C++ Debugging + jnoortheen.nix-ide # Nix + tamasfe.even-better-toml # TOML + yzhang.markdown-all-in-one # Markdown + denoland.vscode-deno # Deno JS/TS + # Theming + pkief.material-icon-theme # Material icons + # Utilities + streetsidesoftware.code-spell-checker # Spellchecking + jeanp413.open-remote-ssh # Remote SSH + ]) + ++ (with vscode-marketplace; [ + yy0931.save-as-root # Save as root over SSH + ]) + ); userSettings = { # Editor "editor.fontFamily" = "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace"; "editor.indentSize" = "tabSize"; "editor.tabSize" = 4; + "files.associations" = { + "*.hujson" = "jsonc"; + }; # JJ "files.watcherExclude" = { "**/.git/objects/**" = true;