refactor: add ai config option

This commit is contained in:
Moritz Böhme 2024-10-24 20:32:29 +02:00
parent e525d68112
commit 72e98aa61c
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
3 changed files with 43 additions and 30 deletions

View file

@ -14,6 +14,7 @@
];
my = {
ai.enable = true;
profiles = {
desktop.enable = true;
gaming.enable = true;

8
modules/config/ai.nix Normal file
View file

@ -0,0 +1,8 @@
{ lib
, ...
}:
with lib;
{
options.my.ai.enable = mkEnableOption "AI stuff";
}

View file

@ -1,37 +1,41 @@
{ config, lib, pkgs, inputs, ... }:
{ config, lib, pkgs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
inherit (lib) mkIf;
cfg = config.my.ai;
in
{
home-manager.users.moritz.programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
nui-nvim
render-markdown-nvim
avante-nvim
];
extraConfigLuaPost = ''
require("render-markdown").setup({ file_types = {"markdown", "Avante"} })
config = mkIf cfg.enable {
home-manager.users.moritz.programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
nui-nvim
render-markdown-nvim
avante-nvim
];
extraConfigLuaPost = ''
require("render-markdown").setup({ file_types = {"markdown", "Avante"} })
require("avante_lib").load()
require("avante").setup({
provider = "openai",
auto_suggestions_provider = "openai",
behaviour = {
-- auto_suggestions = true,
},
openai = {
model = "gpt-4o",
api_key_name = "cmd:cat /run/agenix/openai"
}
})
'';
# plugins.copilot-lua.enable = true;
# plugins.copilot-lua.suggestion.enabled = false;
# plugins.copilot-lua.panel.enabled = false;
plugins.dressing.enable = true;
# performance.combinePlugins.standalonePlugins = [ "copilot.lua" ];
require("avante_lib").load()
require("avante").setup({
provider = "openai",
auto_suggestions_provider = "openai",
behaviour = {
-- auto_suggestions = true,
},
openai = {
model = "gpt-4o",
api_key_name = "cmd:cat /run/agenix/openai"
}
})
'';
plugins.dressing.enable = true;
};
age.secrets = {
"openai".file = ../../../../secrets/openai.age;
"openai".owner = "moritz";
anthropic.file = ../../../../secrets/anthropic.age;
anthropic.owner = "moritz";
};
};
age.secrets."openai".file = ../../../../secrets/openai.age;
age.secrets."openai".owner = "moritz";
}