helix: add aichat

This commit is contained in:
Giulio De Pasquale 2024-04-11 12:32:58 +01:00
parent 57f5b0a4e2
commit fe22704b14

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, lib, stdenv, ... }:
let let
actualPkgs = pkgs.unstablePkgs; actualPkgs = pkgs.unstablePkgs;
@ -17,6 +17,24 @@ let
bash-language-server bash-language-server
pyright pyright
]; ];
aichatConfigDir = "$HOME/.config/aichat";
aichatConfig = ''
model: ollama
clients:
- type: ollama
api_base: https://ollama.giugl.io
api_key: null
models:
- name: pino-fast
max_input_tokens: null
'';
aichatRoles = ''
- name: comment
prompt: >
As a helpful assistant designed to assist in documenting code, your primary task is to review the provided code and add clear, concise comments and documentation that will help other developers understand its purpose, functionality, and implementation details. Your comments should be written using language-specific conventions, such as docstrings for Python or Javadoc for Java, to ensure compatibility and maximize their utility for users of different programming languages.
When adding comments, focus on conveying essential information about the code, including its inputs, outputs, and behavior, but avoid getting bogged down in unnecessary detail. Your goal is to provide enough context and explanation to allow a competent developer to understand how the code works and how to use it effectively, without overwhelming them with irrelevant or overly technical information.
UNDER NO CIRCUMSTANCES should you modify the code itself. Your role is purely to document and explain the code as it currently exists, not to make changes or suggest improvements. By focusing on providing high-quality documentation, you can help ensure that the code is easy to understand, use, and maintain, even as it evolves over time.
'';
in in
{ {
home = { home = {
@ -39,9 +57,11 @@ in
sessionVariables = { sessionVariables = {
EDITOR = "hx"; EDITOR = "hx";
VISUAL = "hx"; VISUAL = "hx";
AICHAT_CONFIG_DIR = aichatConfigDir;
}; };
file.".config/helix/config.toml".text = '' file = {
".config/helix/config.toml".text = ''
theme = "monokai_pro_spectrum" theme = "monokai_pro_spectrum"
[editor] [editor]
@ -63,32 +83,13 @@ in
[editor.statusline] [editor.statusline]
left = ["mode", "spinner"] left = ["mode", "spinner"]
center = ["file-name"] center = ["file-name"]
[keys.select.l]
c = ":pipe ${pkgs.unstablePkgs.aichat}/bin/aichat -c -r comment"
''; '';
file.".config/helix/languages.toml".text = '' "${aichatConfigDir}/roles.yaml".text = aichatRoles;
[[language]] "${aichatConfigDir}/config.yaml".text = aichatConfig;
name = "nix" };
formatter = { command = "nixpkgs-fmt" }
[[language]]
name = "python"
formatter = { command = "black", args = [ "-" ] }
language-servers = [ {name = "pyright"}, {name = "ruff-lsp"}, ]
[language-server.pyright]
command = "pyright-langserver"
args = ["--stdio"]
config = {}
[language-server.ruff-lsp]
command = "ruff-lsp"
args = []
config = {}
[[language]]
name = "bash"
indent = { tab-width = 2, unit = " " }
formatter = { command = 'shfmt', args = ["-i", "2"] }
'';
}; };
} }