nixos-config/modules/home-manager/vscode.nix

257 lines
6.7 KiB
Nix
Raw Normal View History

2024-08-25 09:45:58 +00:00
{
inputs,
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.custom-hm.vscode;
packages = {
nixPackages = {
2024-08-25 09:45:58 +00:00
systemPackages = with pkgs; [
nixd
nixpkgs-fmt
];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
jnoortheen.nix-ide
];
settings = {
"nix.enableLanguageServer" = true;
"nix.formatterPath" = "nixpkgs-fmt";
"nix.serverPath" = "nixd";
};
};
cxxPackages = {
2024-08-25 09:45:58 +00:00
systemPackages = with pkgs; [
clang-tools
cmake-format
];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
llvm-vs-code-extensions.vscode-clangd
2024-08-25 09:45:58 +00:00
(ms-vscode.cmake-tools.overrideAttrs (_: {
sourceRoot = "extension";
}))
twxs.cmake
ms-vscode.cpptools
];
settings = {
"cmake.configureOnEdit" = false;
"cmake.showOptionsMovedNotification" = false;
"cmake.showNotAllDocumentsSavedQuestion" = false;
2024-07-14 06:04:52 +00:00
"cmake.pinnedCommands" = [
"workbench.action.tasks.configureTaskRunner"
"workbench.action.tasks.runTask"
2024-08-20 13:07:34 +00:00
];
"C_Cpp.intelliSenseEngine" = "Disabled";
};
};
pythonPackages = {
systemPackages = with pkgs; [ ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
ms-python.python
];
settings = { };
};
scalaPackages = {
2024-08-25 09:45:58 +00:00
systemPackages = with pkgs; [
coursier
metals
];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
scala-lang.scala
scalameta.metals
];
settings = { };
};
latexPackages = {
systemPackages = with pkgs; [ texliveSmall ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
james-yu.latex-workshop
];
settings = {
"latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [
2024-08-20 13:07:34 +00:00
{
"name" = "xelatex";
"command" = "xelatex";
2024-08-25 09:45:58 +00:00
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"%DOCFILE%"
];
}
2024-08-20 13:07:34 +00:00
{
"name" = "pdflatex";
"command" = "pdflatex";
2024-08-25 09:45:58 +00:00
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"%DOCFILE%"
];
}
{
"name" = "bibtex";
"command" = "bibtex";
"args" = [ "%DOCFILE%" ];
}
];
"latex-workshop.latex.recipes" = [
2024-08-25 09:45:58 +00:00
{
"name" = "xelatex";
"tools" = [ "xelatex" ];
}
{
"name" = "pdflatex";
"tools" = [ "pdflatex" ];
}
{
"name" = "xe->bib->xe->xe";
"tools" = [
"xelatex"
"bibtex"
"xelatex"
"xelatex"
];
}
{
"name" = "pdf->bib->pdf->pdf";
"tools" = [
"pdflatex"
"bibtex"
"pdflatex"
"pdflatex"
];
}
];
"[latex]" = {
"editor.formatOnPaste" = false;
"editor.suggestSelection" = "recentlyusedbyprefix";
"editor.wordWrap" = "bounded";
"editor.wordWrapColumn" = 80;
"editor.unicodeHighlight.ambiguousCharacters" = false;
};
};
};
};
2024-08-20 13:07:34 +00:00
llmExtensions = [ pkgs.vscode-extensions.continue.continue ];
2024-08-25 09:45:58 +00:00
languages = [
"nix"
"cxx"
"python"
"scala"
"latex"
];
zipAttrsWithLanguageOption = (
attr: (map (l: (lib.mkIf cfg.languages.${l} packages."${l}Packages".${attr})) languages)
);
in
{
2024-01-13 02:47:37 +00:00
options.custom-hm.vscode = {
enable = mkEnableOption "Vscode config";
languages = {
nix = mkOption {
type = lib.types.bool;
default = true;
};
cxx = mkEnableOption "C++";
python = mkEnableOption "Python";
scala = mkEnableOption "Scala";
latex = mkEnableOption "Latex";
};
2024-08-20 13:07:34 +00:00
llm = mkEnableOption "tab completion with Continue and ollama";
};
config = mkIf cfg.enable {
2024-07-15 02:54:25 +00:00
nixpkgs.config.allowUnfree = true;
2024-08-25 09:45:58 +00:00
home.packages = lib.mkMerge (
[
[ pkgs.clang-tools ]
(mkIf cfg.llm [ pkgs.ollama ])
]
++ zipAttrsWithLanguageOption "systemPackages"
);
programs.vscode = {
enable = true;
package = pkgs.vscode.override { commandLineArgs = "--enable-wayland-ime"; };
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
mutableExtensionsDir = false;
2024-08-25 09:45:58 +00:00
extensions = lib.mkMerge (
[
(with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
mkhl.direnv
2024-08-25 09:45:58 +00:00
ms-azuretools.vscode-docker
ms-vscode-remote.remote-ssh
vscodevim.vim
github.vscode-pull-request-github
gruntfuggly.todo-tree # todo highlight
2024-03-25 08:26:48 +00:00
2024-08-25 09:45:58 +00:00
# Markdown
davidanson.vscode-markdownlint
# Latex
# Scale / chisel
sterben.fpga-support
2024-08-25 09:45:58 +00:00
ms-vscode-remote.remote-ssh-edit
mushan.vscode-paste-image
])
2024-08-20 13:07:34 +00:00
2024-08-25 09:45:58 +00:00
(with pkgs.vscode-extensions; [
waderyan.gitblame
catppuccin.catppuccin-vsc
# Rust
rust-lang.rust-analyzer
])
2024-08-20 13:07:34 +00:00
2024-08-25 09:45:58 +00:00
(mkIf cfg.llm llmExtensions)
]
++ zipAttrsWithLanguageOption "extension"
);
userSettings = lib.mkMerge (
[
{
"workbench.colorTheme" = "Catppuccin Macchiato";
"terminal.integrated.sendKeybindingsToShell" = true;
"extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay";
"editor.inlineSuggest.enabled" = true;
"editor.rulers" = [ 80 ];
"editor.mouseWheelZoom" = true;
"git.autofetch" = false;
"window.zoomLevel" = -1;
2024-08-25 09:45:58 +00:00
"extensions.experimental.affinity" = {
"vscodevim.vim" = 1;
};
}
]
++ zipAttrsWithLanguageOption "settings"
);
2024-08-20 13:07:34 +00:00
};
home.file.".continue/config.json".text = lib.generators.toJSON { } {
models = [
{
model = "AUTODETECT";
provider = "ollama";
title = "Ollama";
}
];
tabAutocompleteModel = {
2024-08-25 09:45:58 +00:00
model = "deepseek-coder:6.7b-base";
2024-08-20 13:07:34 +00:00
provider = "ollama";
title = "codegemma";
};
};
};
2024-08-20 13:07:34 +00:00
}