dotfiles/modules/users/modules/vscode/default.nix

56 lines
1.5 KiB
Nix
Raw Normal View History

2024-07-18 04:08:27 +00:00
{config, lib, pkgs, ... }:
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-18 04:08:27 +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-07-18 11:48:49 +00:00
modules.unfree.allowedPackages = [ "vscode" ];
2024-07-18 16:13:19 +00:00
theming.fonts.extraFonts = [
cfg.codeFont
2024-07-18 04:08:27 +00:00
];
2024-07-18 16:13:19 +00:00
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
eamodio.gitlens
# Language support
# TODO: Move to separate language modules
bbenoist.nix
rust-lang.rust-analyzer
];
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}'";
"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-18 16:13:19 +00:00
# Autoformatting
"editor.formatOnSave" = true;
2024-07-19 01:34:42 +00:00
# Layout
"window.menuBarVisibility" = "hidden";
2024-07-18 16:13:19 +00:00
};
};
2024-07-18 04:08:27 +00:00
};
}