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; };
git = { enable = true; signing.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; };
};
@ -59,4 +59,19 @@
enable = true;
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

@ -43,7 +43,7 @@ let
settings = { };
};
scalaPackages = {
systemPackages = with pkgs; [ coursier ];
systemPackages = with pkgs; [ coursier metals ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
scala-lang.scala
scalameta.metals
@ -58,11 +58,13 @@ let
settings = {
"latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [
{ "name" = "xelatex";
{
"name" = "xelatex";
"command" = "xelatex";
"args" = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOCFILE%" ];
}
{ "name" = "pdflatex";
{
"name" = "pdflatex";
"command" = "pdflatex";
"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" ];
zipAttrsWithLanguageOption = (attr:
@ -103,12 +106,14 @@ in
scala = mkEnableOption "Scala";
latex = mkEnableOption "Latex";
};
llm = mkEnableOption "tab completion with Continue and ollama";
};
config = mkIf cfg.enable {
nixpkgs.config.allowUnfree = true;
home.packages = lib.mkMerge ([
[ pkgs.clang-tools ]
(mkIf cfg.llm [ pkgs.ollama ])
] ++ zipAttrsWithLanguageOption "systemPackages");
programs.vscode = {
enable = true;
@ -135,15 +140,19 @@ in
ms-vscode-remote.remote-ssh-edit
mushan.vscode-paste-image
])
(with pkgs.vscode-extensions; [
waderyan.gitblame
catppuccin.catppuccin-vsc
# Rust
rust-lang.rust-analyzer
])
(mkIf cfg.llm llmExtensions)
] ++ zipAttrsWithLanguageOption "extension");
userSettings = lib.mkMerge ([
{"workbench.colorTheme" = "Catppuccin Macchiato";
{
"workbench.colorTheme" = "Catppuccin Macchiato";
"terminal.integrated.sendKeybindingsToShell" = true;
"extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay";
@ -158,7 +167,24 @@ in
"extensions.experimental.affinity" = {
"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";
};
};
};
}