Skip to content

Commit 7a1df68

Browse files
authored
feat(home-manager): add support for vscode (#509)
1 parent 4cb9c62 commit 7a1df68

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed

modules/home-manager/all-modules.nix

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
./thunderbird.nix
4848
./tmux.nix
4949
./tofi.nix
50+
./vscode.nix
5051
./waybar.nix
5152
./wlogout.nix
5253
./yazi.nix

modules/home-manager/vscode.nix

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{ catppuccinLib }:
2+
{ config, lib, ... }:
3+
4+
let
5+
inherit (config.catppuccin) sources;
6+
cfg = config.catppuccin.vscode;
7+
8+
usesPerProfileCfg = lib.versionAtLeast catppuccinLib.getModuleRelease "25.05";
9+
settings = {
10+
extensions = [ sources.vscode ];
11+
12+
userSettings = {
13+
"workbench.colorTheme" = "Catppuccin " + catppuccinLib.mkUpper cfg.flavor;
14+
"catppuccin.accentColor" = cfg.accent;
15+
16+
# Recommended settings
17+
# https://github.com/catppuccin/vscode?tab=readme-ov-file#vscode-settings
18+
"editor.semanticHighlighting.enabled" = lib.mkDefault true;
19+
"terminal.integrated.minimumContrastRatio" = lib.mkDefault 1;
20+
"window.titleBarStyle" = lib.mkDefault "custom";
21+
};
22+
};
23+
in
24+
25+
{
26+
options.catppuccin.vscode = catppuccinLib.mkCatppuccinOption {
27+
name = "vscode";
28+
accentSupport = true;
29+
};
30+
31+
config = lib.mkIf cfg.enable {
32+
# TODO: Remove compat layer when 25.05 is stable
33+
# https://github.com/nix-community/home-manager/pull/5640
34+
programs.vscode =
35+
if usesPerProfileCfg then
36+
{
37+
profiles.default = settings;
38+
}
39+
else
40+
settings;
41+
};
42+
}

modules/tests/home.nix

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, ... }:
1+
{ lib, pkgs, ... }:
22

33
{
44
imports = [
@@ -65,6 +65,10 @@
6565
enable = true;
6666
profiles.catppuccin-mocha-mauve.isDefault = true;
6767
};
68+
vscode = {
69+
enable = true;
70+
package = pkgs.vscodium;
71+
};
6872
waybar.enable = true;
6973
wlogout.enable = true;
7074
yazi.enable = true;

pkgs/vscode/package.nix

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{ vscode-utils, ... }:
2+
3+
vscode-utils.buildVscodeMarketplaceExtension {
4+
mktplcRef = {
5+
name = "catppuccin-vsc";
6+
publisher = "catppuccin";
7+
version = "3.16.1";
8+
hash = "sha256-qEwQ583DW17dlJbODN8SNUMbDMCR1gUH4REaFkQT65I=";
9+
};
10+
}

0 commit comments

Comments
 (0)