dotfiles/user-modules/vscode/default.nix

75 lines
1.8 KiB
Nix
Raw Normal View History

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