modules/vscode: llm support

This commit is contained in:
xinyangli 2024-08-20 21:07:34 +08:00
parent 47ee5ef21f
commit ed19829fe4
Signed by: xin
SSH key fingerprint: SHA256:qZ/tzd8lYRtUFSrfBDBMcUqV4GHKxqeqRA3huItgvbk
2 changed files with 61 additions and 20 deletions

View file

@ -51,7 +51,7 @@
fish = { enable = true; }; fish = { enable = true; };
git = { enable = true; signing.enable = true; }; git = { enable = true; signing.enable = true; };
neovim = { enable = true; }; neovim = { enable = true; };
vscode = { enable = true; languages = { cxx = true; python = true; scala = true; latex = true; }; }; vscode = { enable = true; languages = { cxx = true; python = true; scala = true; latex = true; }; llm = true; };
zellij = { enable = true; }; zellij = { enable = true; };
}; };
@ -59,4 +59,19 @@
enable = true; enable = true;
flags = [ "--disable-up-arrow" ]; flags = [ "--disable-up-arrow" ];
}; };
programs.firefox.enable = true;
programs.firefox.policies = {
DefaultDownloadDirectory = "/media/data/Downloads";
};
programs.firefox.profiles.default = {
isDefault = true;
userChrome = builtins.readFile "${pkgs.fetchgit {
url = "https://gist.github.com/0ded98af9fe3da35f3688f81364d8c14.git";
rev = "11bb4f428382052bcbbceb6cc3fef97f3c939481";
hash = "sha256-J11indzEGdUA0HSW8eFe5AjesOxCL/G05KwkJk9GZSY=";
}}/userChrome.css";
};
} }

View file

@ -31,7 +31,7 @@ let
"cmake.pinnedCommands" = [ "cmake.pinnedCommands" = [
"workbench.action.tasks.configureTaskRunner" "workbench.action.tasks.configureTaskRunner"
"workbench.action.tasks.runTask" "workbench.action.tasks.runTask"
]; ];
"C_Cpp.intelliSenseEngine" = "Disabled"; "C_Cpp.intelliSenseEngine" = "Disabled";
}; };
}; };
@ -43,7 +43,7 @@ let
settings = { }; settings = { };
}; };
scalaPackages = { scalaPackages = {
systemPackages = with pkgs; [ coursier ]; systemPackages = with pkgs; [ coursier metals ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
scala-lang.scala scala-lang.scala
scalameta.metals scalameta.metals
@ -58,11 +58,13 @@ let
settings = { settings = {
"latex-workshop.latex.autoBuild.run" = "never"; "latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [ "latex-workshop.latex.tools" = [
{ "name" = "xelatex"; {
"name" = "xelatex";
"command" = "xelatex"; "command" = "xelatex";
"args" = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOCFILE%" ]; "args" = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOCFILE%" ];
} }
{ "name" = "pdflatex"; {
"name" = "pdflatex";
"command" = "pdflatex"; "command" = "pdflatex";
"args" = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOCFILE%" ]; "args" = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOCFILE%" ];
} }
@ -84,6 +86,7 @@ let
}; };
}; };
}; };
llmExtensions = [ pkgs.vscode-extensions.continue.continue ];
languages = [ "nix" "cxx" "python" "scala" "latex" ]; languages = [ "nix" "cxx" "python" "scala" "latex" ];
zipAttrsWithLanguageOption = (attr: zipAttrsWithLanguageOption = (attr:
@ -103,12 +106,14 @@ in
scala = mkEnableOption "Scala"; scala = mkEnableOption "Scala";
latex = mkEnableOption "Latex"; latex = mkEnableOption "Latex";
}; };
llm = mkEnableOption "tab completion with Continue and ollama";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
home.packages = lib.mkMerge ([ home.packages = lib.mkMerge ([
[ pkgs.clang-tools ] [ pkgs.clang-tools ]
(mkIf cfg.llm [ pkgs.ollama ])
] ++ zipAttrsWithLanguageOption "systemPackages"); ] ++ zipAttrsWithLanguageOption "systemPackages");
programs.vscode = { programs.vscode = {
enable = true; enable = true;
@ -135,30 +140,51 @@ in
ms-vscode-remote.remote-ssh-edit ms-vscode-remote.remote-ssh-edit
mushan.vscode-paste-image mushan.vscode-paste-image
]) ])
(with pkgs.vscode-extensions; [ (with pkgs.vscode-extensions; [
waderyan.gitblame waderyan.gitblame
catppuccin.catppuccin-vsc catppuccin.catppuccin-vsc
# Rust # Rust
rust-lang.rust-analyzer rust-lang.rust-analyzer
]) ])
(mkIf cfg.llm llmExtensions)
] ++ zipAttrsWithLanguageOption "extension"); ] ++ zipAttrsWithLanguageOption "extension");
userSettings = lib.mkMerge ([ userSettings = lib.mkMerge ([
{"workbench.colorTheme" = "Catppuccin Macchiato"; {
"terminal.integrated.sendKeybindingsToShell" = true; "workbench.colorTheme" = "Catppuccin Macchiato";
"extensions.ignoreRecommendations" = true; "terminal.integrated.sendKeybindingsToShell" = true;
"files.autoSave" = "afterDelay"; "extensions.ignoreRecommendations" = true;
"editor.inlineSuggest.enabled" = true; "files.autoSave" = "afterDelay";
"editor.rulers" = [ "editor.inlineSuggest.enabled" = true;
80 "editor.rulers" = [
]; 80
"editor.mouseWheelZoom" = true; ];
"git.autofetch" = false; "editor.mouseWheelZoom" = true;
"window.zoomLevel" = -1; "git.autofetch" = false;
"window.zoomLevel" = -1;
"extensions.experimental.affinity" = { "extensions.experimental.affinity" = {
"vscodevim.vim" = 1; "vscodevim.vim" = 1;
}; };
}] ++ zipAttrsWithLanguageOption "settings"); }
] ++ zipAttrsWithLanguageOption "settings");
};
home.file.".continue/config.json".text = lib.generators.toJSON { } {
models = [
{
model = "AUTODETECT";
provider = "ollama";
title = "Ollama";
}
];
tabAutocompleteModel = {
model ="deepseek-coder:6.7b-base";
provider = "ollama";
title = "codegemma";
};
}; };
}; };
} }