75 lines
1.8 KiB
Nix
Raw Normal View History

2024-07-19 14:00:55 +02:00
{
config,
lib,
pkgs,
...
}:
2024-07-18 06:08:27 +02:00
2024-07-18 18:13:19 +02:00
with lib;
2024-07-18 06:08:27 +02:00
let
cfg = config.modules.vscode;
2024-07-18 18:13:19 +02:00
theme = config.theming;
2024-07-19 14:00:55 +02:00
in
{
2024-07-18 18:13:19 +02:00
options.modules.vscode = {
enable = mkEnableOption "vscode";
codeFont = mkOption {
type = types.anything;
default = theme.fonts.pkgs."Fira Code";
};
2024-07-18 22:21:06 +02:00
fallbackFont = mkOption {
type = types.anything;
default = theme.fonts.pkgs."Symbols Nerd Font Mono";
};
2024-07-18 18:13:19 +02:00
};
2024-07-18 06:08:27 +02:00
2024-07-18 18:13:19 +02:00
config = mkIf cfg.enable {
2024-09-30 16:32:54 +02:00
modules.unfree.allowedPackages = [
"vscode"
"vscode-extension-github-copilot"
"vscode-extension-github-copilot-chat"
2024-12-02 00:56:19 +01:00
"vscode-extension-ms-vsliveshare-vsliveshare"
2024-09-30 16:32:54 +02:00
];
2024-07-19 14:00:55 +02:00
theming.fonts.extraFonts = [ cfg.codeFont ];
2024-07-18 18:13:19 +02:00
programs.vscode = {
enable = true;
2024-07-19 13:59:26 +02:00
mutableExtensionsDir = false;
extensions = with pkgs.vscode-extensions; [
eamodio.gitlens
ms-vscode.hexeditor
2024-09-02 20:03:39 +02:00
mkhl.direnv
usernamehw.errorlens
gruntfuggly.todo-tree
2024-09-30 16:32:54 +02:00
github.copilot
github.copilot-chat
2024-12-02 00:56:19 +01:00
tomoki1207.pdf
ms-vsliveshare.vsliveshare
];
2024-07-18 18:13:19 +02:00
userSettings = {
# Font setup
2024-07-18 22:21:06 +02:00
# TODO: Move the conversion factor to theme settings
"editor.fontFamily" = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'";
2024-07-19 14:00:55 +02:00
"editor.fontSize" = mkForce (cfg.codeFont.recommendedSize); # Convert pt to px
2024-07-18 18:13:19 +02:00
"editor.fontLigatures" = true;
2024-07-18 22:21:06 +02:00
"terminal.integrated.fontFamily" = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'";
"terminal.integrated.fontSize" = mkForce (cfg.codeFont.recommendedSize); # Convert pt to px
2024-07-19 14:00:55 +02:00
2024-07-19 13:59:26 +02:00
# Formatting
2024-07-18 18:13:19 +02:00
"editor.formatOnSave" = true;
2024-07-19 13:59:26 +02:00
"editor.tabSize" = 4;
2024-07-19 03:34:42 +02:00
# Layout
"window.menuBarVisibility" = "hidden";
2024-12-02 00:56:19 +01:00
# Git settings
"git.autofetch" = true;
"git.enableSmartCommit" = false;
2024-07-18 18:13:19 +02:00
};
};
2024-07-18 06:08:27 +02:00
};
2024-07-19 14:00:55 +02:00
}