From 3d2e74d1155c21a817d75e177b84d9973c8fc8e9 Mon Sep 17 00:00:00 2001 From: OlivierChiasson Date: Fri, 17 Jul 2026 17:17:14 -0300 Subject: [PATCH] feat(wisdom): add vscode editor module Add a new module for Visual Studio Code configuration including default extensions (nix-ide, markdown-all-in-one, prettier) and nixd/nixfmt settings. Enable vscode on 14900k, t2mbp, and uConsole hosts with additional extensions. Also clean up unfree predicate logic in ideapad configuration. --- modules/hosts/14900k/home.nix | 8 ++++ modules/hosts/ideapad/configuration.nix | 7 +-- modules/hosts/t2mbp/home.nix | 10 +++- modules/hosts/uConsole/home.nix | 10 +++- modules/wisdom/editors/vscode.nix | 61 +++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 modules/wisdom/editors/vscode.nix diff --git a/modules/hosts/14900k/home.nix b/modules/hosts/14900k/home.nix index eb09722..7de6e58 100644 --- a/modules/hosts/14900k/home.nix +++ b/modules/hosts/14900k/home.nix @@ -22,6 +22,14 @@ spotify.openDiscoveryFirewall = true; pokeclicker.enable = true; }; + + editors.vscode = { + enable = true; + extensions = with pkgs.vscode-extensions; [ + alefragnani.project-manager + johnpapa.vscode-peacock + ]; + }; }; } ]; diff --git a/modules/hosts/ideapad/configuration.nix b/modules/hosts/ideapad/configuration.nix index a10b276..078d1ba 100644 --- a/modules/hosts/ideapad/configuration.nix +++ b/modules/hosts/ideapad/configuration.nix @@ -42,12 +42,7 @@ # rebuilds Mobile NixOS' script-loader against the patched mruby. chiasson.system.ideapadMrubyOverlay.enable = true; - # Wi-Fi modem (qcom-wcn3990) + Bluetooth (QCA crnv32) need binary blobs. - nixpkgs.config.allowUnfreePredicate = - pkg: builtins.elem (lib.getName pkg) [ - "chromeos-sc7180-unredistributable-firmware" - "chromeos-sc7180-unredistributable-firmware-zstd" - ]; + # Wi-Fi modem (qcom-wcn3990) + Bluetooth (QCA crnv32) need binary blobs hardware.firmware = [ pkgs.chromeos-sc7180-unredistributable-firmware ]; hardware.enableRedistributableFirmware = true; diff --git a/modules/hosts/t2mbp/home.nix b/modules/hosts/t2mbp/home.nix index b267c32..2eb90ca 100644 --- a/modules/hosts/t2mbp/home.nix +++ b/modules/hosts/t2mbp/home.nix @@ -1,7 +1,7 @@ { self, inputs, ... }: { flake.nixosModules.t2mbpHome = - { self, ... }: + { self, pkgs, ... }: { imports = [ self.nixosModules.desktopHomeBase ]; @@ -14,6 +14,14 @@ discord.enable = true; pokeclicker.enable = true; }; + + editors.vscode = { + enable = true; + extensions = with pkgs.vscode-extensions; [ + alefragnani.project-manager + johnpapa.vscode-peacock + ]; + }; }; } ]; diff --git a/modules/hosts/uConsole/home.nix b/modules/hosts/uConsole/home.nix index 11a7ef2..827cca1 100644 --- a/modules/hosts/uConsole/home.nix +++ b/modules/hosts/uConsole/home.nix @@ -1,13 +1,21 @@ { self, inputs, ... }: { flake.nixosModules.uConsoleHome = - { self, ... }: + { self, pkgs, ... }: { imports = [ self.nixosModules.desktopHomeBase ]; chiasson.users.extraModules.olivier = [ { chiasson.home.hardware.uconsoleGamepad.enable = true; + + chiasson.home.editors.vscode = { + enable = true; + extensions = with pkgs.vscode-extensions; [ + alefragnani.project-manager + johnpapa.vscode-peacock + ]; + }; } ]; }; diff --git a/modules/wisdom/editors/vscode.nix b/modules/wisdom/editors/vscode.nix new file mode 100644 index 0000000..456d2a8 --- /dev/null +++ b/modules/wisdom/editors/vscode.nix @@ -0,0 +1,61 @@ +# Visual Studio Code (Microsoft build, unfree). Default extensions + settings shared by all +# hosts; per-host extras (peacock, comment-anchors, project-manager) go via +# `chiasson.home.editors.vscode.extensions`. +{ self, ... }: { + flake.homeManagerModules.wisdomEditorsVscode = + { config, lib, pkgs, ... }: + let + root = config.chiasson.home; + cfg = config.chiasson.home.editors.vscode; + + defaultExtensions = with pkgs.vscode-extensions; [ + jnoortheen.nix-ide + yzhang.markdown-all-in-one + esbenp.prettier-vscode + ]; + + coreSettings = { + "nix.enableLanguageServer" = true; + "nix.serverPath" = "nixd"; + "nix.serverSettings" = { + nixd = { + formatting = { + command = "nixfmt"; + }; + }; + }; + "diffEditor.ignoreTrimWhitespace" = false; + "chat.disableAIFeatures" = true; + }; + in + { + options.chiasson.home.editors.vscode = { + enable = lib.mkEnableOption '' + Visual Studio Code (Microsoft build; needs `nixpkgs.config.allowUnfree`). Core + extensions (nix-ide, markdown-all-in-one, prettier) + nixd/nixfmt settings are included. + '' // { + default = false; + }; + + extensions = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + description = '' + Extra extensions not wanted on every host (e.g. peacock, comment-anchors, + project-manager). Per-host via `chiasson.users.extraModules`. + ''; + }; + }; + + config = lib.mkIf (root.enable && cfg.enable) { + home.packages = [ pkgs.vscode ]; + + programs.vscode = { + enable = true; + package = pkgs.vscode; + extensions = defaultExtensions ++ cfg.extensions; + userSettings = coreSettings; + }; + }; + }; +}