stylix/modules/vscode/hm.nix

37 lines
1 KiB
Nix
Raw Permalink Normal View History

2022-10-26 17:29:56 +00:00
{pkgs, config, lib, ... }:
with config.stylix.fonts;
2022-10-26 17:29:56 +00:00
let
themeFile = config.lib.stylix.colors {
2023-07-14 11:50:08 +00:00
template = ./template.mustache;
2022-10-26 17:29:56 +00:00
extension = ".json";
};
2023-04-19 08:33:49 +00:00
themeExtension = pkgs.runCommandLocal "stylix-vscode" {
vscodeExtUniqueId = "stylix.stylix";
vscodeExtPublisher = "stylix";
2022-10-26 17:29:56 +00:00
version = "0.0.0";
2023-04-19 08:33:49 +00:00
} ''
mkdir -p "$out/share/vscode/extensions/$vscodeExtUniqueId/themes"
ln -s ${./package.json} "$out/share/vscode/extensions/$vscodeExtUniqueId/package.json"
ln -s ${themeFile} "$out/share/vscode/extensions/$vscodeExtUniqueId/themes/stylix.json"
2022-10-26 17:29:56 +00:00
'';
in {
options.stylix.targets.vscode.enable =
config.lib.stylix.mkEnableTarget "VSCode" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vscode.enable) {
programs.vscode = {
extensions = [ themeExtension ];
userSettings = {
"workbench.colorTheme" = "Stylix";
"terminal.integrated.fontFamily" = "'${monospace.name}'";
"editor.fontFamily" = "'${monospace.name}'";
};
};
2022-10-26 17:29:56 +00:00
};
}