Files
Nomarchy/features/apps/vscode.nix
Bernardo Magri 9b26eda388 fix(vscode): pin theme extensions for 10 marketplace palettes
Before this fix, only the 6 palettes whose theme extensions ship in
pkgs.vscode-extensions had working VSCode theming. Every other palette
had `workbench.colorTheme` set to a name VSCode couldn't find, so it
silently fell back to its built-in default. Including the DEFAULT
summer-night palette (sainnhe.everforest) — the default install had
broken VSCode theming.

Probed the 13 unique extensions against the VSCode marketplace
extensionquery API:

  - 10 exist and are pinnable: sainnhe.everforest,
    shadesOfBuntu.flexoki-light, qufiwefefwoyn.kanagawa,
    oldjobobo.{lumon,miasma,retro-82}-theme, TahaYVR.matteblack,
    jovejonovski.ocean-green, monokai.theme-monokai-pro-vscode,
    Bjarne.white-theme.
  - 3 don't exist on the marketplace and are unpublished custom
    Nomarchy themes: Bjarne.{ethereal,hackerman,vantablack}-nomarchy.
    Logged as a new Later row.

For the 10, fetched version + sha256 via:

  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"

Added a marketplaceExtensions list to features/apps/vscode.nix that
wraps each in pkgs.vscode-utils.extensionFromVscodeMarketplace and
concatenates with the existing nixpkgs-packaged list — so 10 more
palettes (including the default) now get correct VSCode theming on
first launch. Smoke-built sainnhe.everforest end-to-end. Module
comment documents the version-bump procedure.

docs/OPTIONS.md updated: the nomarchy.vscode.devExtensions entry
drops the "still break" caveat for everything except the three
unpublished Bjarne palettes.

`nix flake check --no-build` clean.
2026-05-22 20:21:43 +01:00

125 lines
5.2 KiB
Nix

{ 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
);
};
};
}