nixos/roles/home/helix.nix
Giulio De Pasquale fe22704b14 helix: add aichat
2024-04-11 12:32:58 +01:00

96 lines
3.1 KiB
Nix

{ pkgs, lib, stdenv, ... }:
let
actualPkgs = pkgs.unstablePkgs;
pythonPkgs = with actualPkgs.python3Packages; [
python-lsp-server
python-lsp-ruff
pylsp-mypy
];
nodePkgs = with actualPkgs.nodePackages; [
vscode-langservers-extracted
typescript
svelte-language-server
yaml-language-server
typescript-language-server
bash-language-server
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
{
home = {
packages = with actualPkgs; [
black
helix
clang-tools
rust-analyzer
nil
texlab
nixpkgs-fmt
ruff
ruff-lsp
mypy
shellcheck
shfmt
gopls
# ] ++ pythonPkgs ++ nodePkgs;
] ++ nodePkgs;
sessionVariables = {
EDITOR = "hx";
VISUAL = "hx";
AICHAT_CONFIG_DIR = aichatConfigDir;
};
file = {
".config/helix/config.toml".text = ''
theme = "monokai_pro_spectrum"
[editor]
cursorline = true
true-color = true
gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
[editor.lsp]
display-messages = true
[editor.indent-guides]
render = true
[editor.statusline]
left = ["mode", "spinner"]
center = ["file-name"]
[keys.select.l]
c = ":pipe ${pkgs.unstablePkgs.aichat}/bin/aichat -c -r comment"
'';
"${aichatConfigDir}/roles.yaml".text = aichatRoles;
"${aichatConfigDir}/config.yaml".text = aichatConfig;
};
};
}