{ config, pkgs, lib, ... }: let themePath = ../../themes/palettes + "/${config.nomarchy.theme}/apps/vscode.json"; themeConfig = if builtins.pathExists themePath then builtins.fromJSON (builtins.readFile themePath) else { name = "Default Dark Modern"; }; # Theme extensions matching palette vscode.json `extension` fields. # Always installed because workbench.colorTheme is set unconditionally # from the active palette — without the matching extension VSCode # silently falls back to its default theme. # # The list is split because nixpkgs doesn't package every theme our # palettes use. Six are in pkgs.vscode-extensions; the rest are pulled # from the VSCode marketplace via extensionFromVscodeMarketplace with # publisher / name / version / sha256 pinned. To refresh a version, # bump the `version` and `nix-prefetch-url` the new .vsix: # # URL='https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${name}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage' # nix store prefetch-file --hash-type sha256 "$URL" # # Three palette extensions remain unfixed because the corresponding # marketplace entries don't exist — Bjarne.ethereal-nomarchy, # Bjarne.hackerman-nomarchy, Bjarne.vantablack-nomarchy. The matching # palettes (ethereal, hackerman, vantablack) still fall back to # VSCode's default theme; see the ROADMAP Later row for next steps. marketplaceExtensions = with pkgs.vscode-utils; [ (extensionFromVscodeMarketplace { # everforest, summer-day, summer-night publisher = "sainnhe"; name = "everforest"; version = "0.3.0"; sha256 = "sha256-nZirzVvM160ZTpBLTimL2X35sIGy5j2LQOok7a2Yc7U="; }) (extensionFromVscodeMarketplace { # flexoki-light publisher = "shadesOfBuntu"; name = "flexoki-light"; version = "1.0.0"; sha256 = "sha256-//y9uvIUGGDEhd8inDHvNy2e1IKNx6hSfO9sxNOTcUE="; }) (extensionFromVscodeMarketplace { # kanagawa publisher = "qufiwefefwoyn"; name = "kanagawa"; version = "1.5.1"; sha256 = "sha256-AGGioXcK/fjPaFaWk2jqLxovUNR59gwpotcSpGNbj1c="; }) (extensionFromVscodeMarketplace { # lumon publisher = "oldjobobo"; name = "lumon-theme"; version = "0.0.7"; sha256 = "sha256-YlO1r1JjaumiicvMk5fBr+PZCYFaII03PaLiyqE35Go="; }) (extensionFromVscodeMarketplace { # matte-black publisher = "TahaYVR"; name = "matteblack"; version = "1.0.3"; sha256 = "sha256-wn/llGidzyPd91XT3xVqAvaU4NcTTggTSz8WmUcV8HM="; }) (extensionFromVscodeMarketplace { # miasma publisher = "oldjobobo"; name = "miasma-theme"; version = "0.1.1"; sha256 = "sha256-STFTGFhQqxocr+YNFQp36IQWJRKTDBgBg4MOCOq1IPQ="; }) (extensionFromVscodeMarketplace { # osaka-jade publisher = "jovejonovski"; name = "ocean-green"; version = "1.1.2"; sha256 = "sha256-sUNjnzqXya23Uieg8RLcEfnxiX0ImZ6CIjFtSJ66vM4="; }) (extensionFromVscodeMarketplace { # retro-82 publisher = "oldjobobo"; name = "retro-82-theme"; version = "0.1.4"; sha256 = "sha256-GqFeFFG5scO7CEXlKjj6uoilCoUfpRaQa5jBSnNJyJA="; }) (extensionFromVscodeMarketplace { # ristretto publisher = "monokai"; name = "theme-monokai-pro-vscode"; version = "2.0.13"; sha256 = "sha256-5bKwVzDfZoSipR04tPDx9jbKhYsSsa3z6Ei9E2jhudo="; }) (extensionFromVscodeMarketplace { # white publisher = "Bjarne"; name = "white-theme"; version = "0.0.1"; sha256 = "sha256-3ZyWNVlQO3Tof49FFF3OImuo7hgtJXLNuwQ+iHjzzGk="; }) ]; themeExtensions = (with pkgs.vscode-extensions; [ catppuccin.catppuccin-vsc # catppuccin, catppuccin-latte enkia.tokyo-night # tokyo-night arcticicestudio.nord-visual-studio-code # nord mvllow.rose-pine # rose-pine jdinhlife.gruvbox # gruvbox ]) ++ marketplaceExtensions; # Development extensions — opt-in via nomarchy.vscode.devExtensions. devExtensions = with pkgs.vscode-extensions; [ # Language support ms-python.python rust-lang.rust-analyzer golang.go jnoortheen.nix-ide # Git integration eamodio.gitlens # Editor enhancements esbenp.prettier-vscode dbaeumer.vscode-eslint bradlc.vscode-tailwindcss ]; in { options.nomarchy.vscode = { devExtensions = lib.mkOption { type = lib.types.bool; default = false; description = "Whether to install development extensions for VSCode."; }; }; config = { programs.vscode = { enable = lib.mkDefault true; package = lib.mkDefault pkgs.vscode; profiles.default.userSettings = lib.mkDefault { "update.mode" = "none"; "workbench.colorTheme" = themeConfig.name; "window.titleBarStyle" = "custom"; "editor.fontFamily" = "'${config.nomarchy.fonts.monospace}', 'Droid Sans Mono', monospace"; "terminal.integrated.fontFamily" = config.nomarchy.fonts.monospace; }; extensions = lib.mkDefault ( themeExtensions ++ lib.optionals config.nomarchy.vscode.devExtensions devExtensions ); }; }; }