mirror of
https://github.com/Alexandre1a/NixOSDots.git
synced 2026-03-10 00:09:46 +01:00
Added a temporary zed2.nix file to test things
This commit is contained in:
parent
6f26ea88ea
commit
2dcc1291c5
@ -5,7 +5,6 @@
|
||||
imports = [
|
||||
inputs.spicetify-nix.homeManagerModules.spicetify
|
||||
../../modules/home-manager/spicetify.nix
|
||||
../../modules/home-manager/secrets.nix
|
||||
../../modules/common/zed.nix
|
||||
];
|
||||
|
||||
@ -21,14 +20,6 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
sops = {
|
||||
enable = true;
|
||||
defaultSopsFile = ../../secrets/secrets.yaml;
|
||||
defaultSopsFormat = "yaml";
|
||||
age = {
|
||||
enable = true;
|
||||
keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
|
||||
};
|
||||
# Zed config
|
||||
zed-custom = {
|
||||
enable = true;
|
||||
|
||||
145
modules/common/zed2.nix
Normal file
145
modules/common/zed2.nix
Normal file
@ -0,0 +1,145 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.zed-ai;
|
||||
|
||||
homeDir = config.home.homeDirectory;
|
||||
|
||||
zedSettings = {
|
||||
language_models = {
|
||||
ollama = {
|
||||
api_url = "http://localhost:11434";
|
||||
available_models = [
|
||||
{ name = "deepseek-r1:8b"; display_name = "DeepSeek-R1 8B (CoT Native)"; max_tokens = 64000; supports_tools = true; supports_thinking = true; supports_images = false; }
|
||||
{ name = "deepseek-r1:14b"; display_name = "DeepSeek-R1 14B (CoT Native)"; max_tokens = 64000; supports_tools = true; supports_thinking = true; supports_images = false; }
|
||||
{ name = "deepseek-coder-v2:16b"; display_name = "Deepseek Coder V2 16B"; max_tokens = 160000; supports_tools = false; supports_thinking = false; supports_images = false; }
|
||||
{ name = "starcoder2:7b"; display_name = "StarCoder2 7B"; max_tokens = 16384; supports_tools = false; supports_thinking = false; supports_images = false; }
|
||||
{ name = "codegemma:7b-instruct"; display_name = "CodeGemma 7B Instruct"; max_tokens = 8192; supports_tools = true; supports_thinking = false; supports_images = false; }
|
||||
{ name = "codegemma:2b"; display_name = "CodeGemma 2B (Fast)"; max_tokens = 8192; supports_tools = false; supports_thinking = false; supports_images = false; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
inline_completions = {
|
||||
provider = "ollama";
|
||||
ollama = {
|
||||
model = "codegemma:2b";
|
||||
api_url = "http://localhost:11434";
|
||||
low_speed_timeout_in_seconds = 30;
|
||||
timeout_in_seconds = 5;
|
||||
};
|
||||
};
|
||||
|
||||
show_edit_predictions = false;
|
||||
|
||||
agent = {
|
||||
default_profile = "reasoning";
|
||||
play_sound_when_agent_done = true;
|
||||
dock = "right";
|
||||
default_model = {
|
||||
provider = "ollama";
|
||||
model = "deepseek-r1:14b";
|
||||
};
|
||||
|
||||
profiles = lib.mapAttrs (name: profile:
|
||||
profile // {
|
||||
context_servers = cfg.mcpServers;
|
||||
}
|
||||
) {
|
||||
reasoning = {
|
||||
name = "Deep Reasoning (CoT)";
|
||||
tools = {
|
||||
copy_path = true; create_directory = true; delete_path = true; diagnostics = true; edit_file = true;
|
||||
fetch = true; list_directory = true; move_path = true; now = true; find_path = true; read_file = true;
|
||||
grep = true; terminal = true; thinking = true; web_search = true; project_notifications = false;
|
||||
};
|
||||
enable_all_context_servers = true;
|
||||
system_prompt = ''
|
||||
You are an expert programming assistant. Break down problems, think step by step, consider edge cases.
|
||||
'';
|
||||
};
|
||||
|
||||
fast = {
|
||||
name = "Fast Development";
|
||||
tools = {
|
||||
copy_path = true; create_directory = true; delete_path = true; diagnostics = true; edit_file = true;
|
||||
fetch = true; list_directory = true; move_path = true; now = true; find_path = true; read_file = true;
|
||||
grep = true; terminal = true; thinking = false; web_search = true; project_notifications = false;
|
||||
};
|
||||
enable_all_context_servers = true;
|
||||
default_model = { provider = "ollama"; model = "codegemma:7b-instruct"; };
|
||||
system_prompt = "Fast assistant: concise, clear, efficient.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ui_font_size = 16;
|
||||
buffer_font_size = 16;
|
||||
theme = "Dracula";
|
||||
icon_theme = "Material Icon Theme";
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
options.programs.zed-ai = {
|
||||
enable = lib.mkEnableOption "Enable Zed AI with CoT";
|
||||
|
||||
mcpServers = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {};
|
||||
description = "MCP servers config";
|
||||
};
|
||||
|
||||
githubToken = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Github token for MCP";
|
||||
};
|
||||
|
||||
braveSearchApiKey = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Brave Search API key";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Déclarer secrets SOPS dans HM
|
||||
sops.secrets = lib.mkIf (cfg.githubToken != null || cfg.braveSearchApiKey != null) {
|
||||
"zed/github_token" = lib.mkIf (cfg.githubToken != null) {};
|
||||
"zed/brave_api_key" = lib.mkIf (cfg.braveSearchApiKey != null) {};
|
||||
};
|
||||
|
||||
# MCP servers dynamiques
|
||||
programs.zed-ai.mcpServers = lib.mkDefault (
|
||||
lib.recursiveUpdate {
|
||||
filesystem = {
|
||||
command = "npx";
|
||||
args = ["-y" "@modelcontextprotocol/server-filesystem" "${homeDir}/Developer"];
|
||||
};
|
||||
|
||||
github = lib.optionalAttrs (cfg.githubToken != null) {
|
||||
command = "npx";
|
||||
args = ["-y" "@modelcontextprotocol/server-github"];
|
||||
env = { GITHUB_PERSONAL_ACCESS_TOKEN = "$(cat ${config.sops.secrets."zed/github_token".path})"; };
|
||||
};
|
||||
|
||||
git = { command = "npx"; args = ["-y" "@modelcontextprotocol/server-git"]; };
|
||||
|
||||
brave-search = lib.optionalAttrs (cfg.braveSearchApiKey != null) {
|
||||
command = "npx";
|
||||
args = ["-y" "@modelcontextprotocol/server-brave-search"];
|
||||
env = { BRAVE_API_KEY = "$(cat ${config.sops.secrets."zed/brave_api_key".path})"; };
|
||||
};
|
||||
} {}
|
||||
);
|
||||
|
||||
# Générer settings.json
|
||||
home.file.".config/zed/settings.json" = {
|
||||
text = builtins.toJSON zedSettings;
|
||||
};
|
||||
|
||||
# SOPS AGE keyFile portable
|
||||
programs.sops.age.keyFile = "${homeDir}/.config/sops/age/keys.txt";
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user