Compare commits
2 commits
9b9c0d90a3
...
d219a5c4e1
Author | SHA1 | Date | |
---|---|---|---|
d219a5c4e1 | |||
a79aea9c9d |
3 changed files with 522 additions and 480 deletions
271
home-manager/ai.nix
Normal file
271
home-manager/ai.nix
Normal file
|
@ -0,0 +1,271 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ethan Reece <contact@ethanreece.com>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
let
|
||||
llm = {
|
||||
remote = {
|
||||
key = "openrouter";
|
||||
name = "OpenRouter";
|
||||
url = "https://openrouter.ai/api/v1";
|
||||
env = "OPENROUTER_API_KEY";
|
||||
models = {
|
||||
fast = {
|
||||
key = "moonshotai/kimi-k2:free";
|
||||
name = "Kimi K2 (free)";
|
||||
provider = [ "chutes/fp8" ];
|
||||
tools = true;
|
||||
tool_call = false;
|
||||
reasoning = false;
|
||||
temperature = true;
|
||||
vision = true;
|
||||
};
|
||||
coding = {
|
||||
key = "moonshotai/kimi-k2";
|
||||
name = "Kimi K2";
|
||||
provider = [ "groq" ];
|
||||
tools = true;
|
||||
tool_call = false;
|
||||
reasoning = false;
|
||||
temperature = true;
|
||||
vision = true;
|
||||
};
|
||||
reasoning = {
|
||||
key = "deepseek/deepseek-r1-0528:free";
|
||||
name = "R1 (free)";
|
||||
provider = [ "chutes" ];
|
||||
tools = true;
|
||||
tool_call = false;
|
||||
reasoning = true;
|
||||
temperature = true;
|
||||
vision = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||
sops = {
|
||||
secrets = {
|
||||
openrouter_api_key = { };
|
||||
};
|
||||
defaultSopsFile = ../sops/secrets.yaml;
|
||||
};
|
||||
programs = {
|
||||
nushell = {
|
||||
environmentVariables = {
|
||||
${llm.remote.env} = lib.hm.nushell.mkNushellInline "cat ${
|
||||
config.sops.secrets."${llm.remote.key}_api_key".path
|
||||
}";
|
||||
shellAliases = {
|
||||
aichat_reasoning_remote = "${pkgs.aichat}/bin/aichat --model ${llm.remote.key}:${llm.remote.models.reasoning.key}";
|
||||
aichat_fast_remote = "${pkgs.aichat}/bin/aichat --model ${llm.remote.key}:${llm.remote.models.fast.key}";
|
||||
codex_remote = "${pkgs.codex}/bin/codex --profile fast_remote";
|
||||
};
|
||||
};
|
||||
};
|
||||
codex = {
|
||||
enable = true;
|
||||
# custom-instructions = ''
|
||||
# ## 10. Applying Patch Files with patch
|
||||
|
||||
# When the built-in `apply_patch` tool or `git apply` fails to apply a diff/patch file (especially if the file being patched contains special characters that might confuse simpler patch tools), the standard `patch` utility can be a more robust alternative.
|
||||
|
||||
# - **Patch File Format**: Ensure your patch file is in a standard unified diff format. Typically, these patches are generated with `git diff > my_feature.patch` or manually crafted. If the patch refers to files with `a/` and `b/` prefixes (e.g., `--- a/file.txt`, `+++ b/file.txt`), you'll use the `-p1` option.
|
||||
|
||||
# - **Creating the Patch File**: You can create a patch file using shell redirection, for example:
|
||||
|
||||
# ```bash`
|
||||
# cat <<'EOF' > fix_descriptive_name.patch
|
||||
# --- a/path/to/your/file.ext
|
||||
# +++ b/path/to/your/file.ext
|
||||
# @@ -line_num,num_lines +line_num,num_lines @@ context_or_change
|
||||
# -old_line_content
|
||||
# +new_line_content
|
||||
# EOF
|
||||
# ```
|
||||
|
||||
# *Important*: Ensure the `EOF` marker is on its own line with no trailing spaces.
|
||||
|
||||
# - **Applying the Patch**: Use the `patch` command via the `shell` tool. The `-p1` option strips the leading component from file paths in the patch file (`a/`, `b/`).
|
||||
|
||||
# ```
|
||||
# # Example: Apply a patch file
|
||||
# default_api.shell(command=["sh", "-c", "patch -p1 < fix_descriptive_name.patch"])
|
||||
# ```
|
||||
|
||||
# - **Verification**: After applying, always verify that the target file has been changed as expected (e.g., using `cat` or `git diff`).
|
||||
|
||||
# - **Cleanup**: Remove the patch file if it's no longer needed:
|
||||
|
||||
# ```
|
||||
# default_api.shell(command=["rm", "fix_descriptive_name.patch"])
|
||||
# ```
|
||||
# '';
|
||||
settings = {
|
||||
model = llm.remote.models.fast.key;
|
||||
model_provider = llm.remote.key;
|
||||
model_providers = {
|
||||
${llm.remote.key} = {
|
||||
name = llm.remote.name;
|
||||
base_url = llm.remote.url;
|
||||
env_key = llm.remote.env;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
opencode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
"$schema" = "https://opencode.ai/config.json";
|
||||
provider = {
|
||||
${llm.remote.key} = {
|
||||
npm = "@ai-sdk/openai-compatible";
|
||||
name = llm.remote.name;
|
||||
options = {
|
||||
baseURL = llm.remote.url;
|
||||
apiKey = "{env:${llm.remote.env}}";
|
||||
};
|
||||
models = {
|
||||
${llm.remote.models.fast.key} = (
|
||||
let
|
||||
model = llm.remote.models.fast;
|
||||
in
|
||||
{
|
||||
id = model.key;
|
||||
name = model.name;
|
||||
options = {
|
||||
tools = model.tools;
|
||||
${llm.remote.name} = {
|
||||
provider = {
|
||||
order = model.provider;
|
||||
allow_fallbacks = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
tool_call = model.tool_call;
|
||||
reasoning = model.reasoning;
|
||||
temperature = model.temperature;
|
||||
}
|
||||
);
|
||||
${llm.remote.models.coding.key} = (
|
||||
let
|
||||
model = llm.remote.models.coding;
|
||||
in
|
||||
{
|
||||
id = model.key;
|
||||
name = model.name;
|
||||
options = {
|
||||
tools = model.tools;
|
||||
${llm.remote.name} = {
|
||||
provider = {
|
||||
order = model.provider;
|
||||
allow_fallbacks = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
tool_call = model.tool_call;
|
||||
reasoning = model.reasoning;
|
||||
temperature = model.temperature;
|
||||
}
|
||||
);
|
||||
${llm.remote.models.reasoning.key} = (
|
||||
let
|
||||
model = llm.remote.models.reasoning;
|
||||
in
|
||||
{
|
||||
id = model.key;
|
||||
name = model.name;
|
||||
options = {
|
||||
tools = model.tools;
|
||||
${llm.remote.name} = {
|
||||
provider = {
|
||||
order = model.provider;
|
||||
allow_fallbacks = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
tool_call = model.tool_call;
|
||||
reasoning = model.reasoning;
|
||||
temperature = model.temperature;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
model = "${llm.remote.key}:${llm.remote.models.fast.key}";
|
||||
};
|
||||
};
|
||||
aichat = {
|
||||
enable = true;
|
||||
settings = {
|
||||
model = "${llm.remote.key}:${llm.remote.models.fast.key}";
|
||||
clients = [
|
||||
# {
|
||||
# type = "openai-compatible";
|
||||
# name = "ollama";
|
||||
# api_base = "http://localhost:11434/v1";
|
||||
# models = [
|
||||
# {
|
||||
# name = "${localFastModel}";
|
||||
# supports_function_calling = true;
|
||||
# supports_vision = true;
|
||||
# }
|
||||
# {
|
||||
# name = "${localReasoningModel}";
|
||||
# supports_function_calling = true;
|
||||
# supports_vision = true;
|
||||
# }
|
||||
# ];
|
||||
# }
|
||||
{
|
||||
type = "openai-compatible";
|
||||
name = llm.remote.key;
|
||||
api_base = llm.remote.url;
|
||||
models = [
|
||||
(
|
||||
let
|
||||
model = llm.remote.models.fast;
|
||||
in
|
||||
{
|
||||
name = model.key;
|
||||
supports_function_calling = model.tools;
|
||||
supports_vision = model.vision;
|
||||
}
|
||||
)
|
||||
(
|
||||
let
|
||||
model = llm.remote.models.coding;
|
||||
in
|
||||
{
|
||||
name = model.key;
|
||||
supports_function_calling = model.tools;
|
||||
supports_vision = model.vision;
|
||||
}
|
||||
)
|
||||
(
|
||||
let
|
||||
model = llm.remote.models.reasoning;
|
||||
in
|
||||
{
|
||||
name = model.key;
|
||||
supports_function_calling = model.tools;
|
||||
supports_vision = model.vision;
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -2,71 +2,22 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# TODO: Add `eza`, `gitui`, `opencode`
|
||||
# TODO: Add `gitui`, `opencode`
|
||||
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
let
|
||||
llm = {
|
||||
remote = {
|
||||
key = "openrouter";
|
||||
name = "OpenRouter";
|
||||
url = "https://openrouter.ai/api/v1";
|
||||
env = "OPENROUTER_API_KEY";
|
||||
models = {
|
||||
fast = {
|
||||
key = "moonshotai/kimi-k2:free";
|
||||
name = "Kimi K2 (free)";
|
||||
provider = [ "chutes/fp8" ];
|
||||
tools = true;
|
||||
tool_call = false;
|
||||
reasoning = false;
|
||||
temperature = true;
|
||||
vision = true;
|
||||
};
|
||||
coding = {
|
||||
key = "moonshotai/kimi-k2";
|
||||
name = "Kimi K2";
|
||||
provider = [ "groq" ];
|
||||
tools = true;
|
||||
tool_call = false;
|
||||
reasoning = false;
|
||||
temperature = true;
|
||||
vision = true;
|
||||
};
|
||||
reasoning = {
|
||||
key = "deepseek/deepseek-r1-0528:free";
|
||||
name = "R1 (free)";
|
||||
provider = [ "chutes" ];
|
||||
tools = true;
|
||||
tool_call = false;
|
||||
reasoning = true;
|
||||
temperature = true;
|
||||
vision = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.catppuccin.homeModules.catppuccin
|
||||
inputs.lix-module.nixosModules.default
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
inputs.stylix.homeModules.stylix
|
||||
./ai.nix
|
||||
./shell.nix
|
||||
];
|
||||
sops = {
|
||||
secrets = {
|
||||
openrouter_api_key = { };
|
||||
};
|
||||
defaultSopsFile = ../sops/secrets.yaml;
|
||||
};
|
||||
# https://nix-community.github.io/stylix/options/modules/alacritty.html
|
||||
stylix = (import ../stylix { inherit config pkgs; }) // {
|
||||
targets = {
|
||||
|
@ -114,11 +65,6 @@ in
|
|||
pkgs.xz
|
||||
];
|
||||
file = { };
|
||||
shell = {
|
||||
enableNushellIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
sessionVariables = {
|
||||
EDITOR = "hx";
|
||||
};
|
||||
|
@ -127,25 +73,19 @@ in
|
|||
home-manager = {
|
||||
enable = true;
|
||||
};
|
||||
bat = {
|
||||
enable = true;
|
||||
};
|
||||
man = {
|
||||
enable = true;
|
||||
};
|
||||
vim = {
|
||||
enable = true;
|
||||
};
|
||||
# TODO: Disable Guix integration
|
||||
# password-store = {
|
||||
# enable = true;
|
||||
# };
|
||||
bat = {
|
||||
enable = true;
|
||||
};
|
||||
nix-your-shell = {
|
||||
enable = true;
|
||||
};
|
||||
fzf = {
|
||||
enable = true;
|
||||
};
|
||||
vim = {
|
||||
enable = true;
|
||||
};
|
||||
helix = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
|
@ -155,211 +95,6 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
nushell = {
|
||||
enable = true;
|
||||
environmentVariables = {
|
||||
${llm.remote.env} = lib.hm.nushell.mkNushellInline "cat ${
|
||||
config.sops.secrets."${llm.remote.key}_api_key".path
|
||||
}";
|
||||
};
|
||||
settings = {
|
||||
completions = {
|
||||
algorithm = "fuzzy";
|
||||
case_sensitive = false;
|
||||
external = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
# set -x ZATHURA_PLUGINS_PATH $GUIX_HOME/lib/zathura
|
||||
shellAliases = {
|
||||
aichat_reasoning_remote = "${pkgs.aichat}/bin/aichat --model ${llm.remote.key}:${llm.remote.models.reasoning.key}";
|
||||
aichat_fast_remote = "${pkgs.aichat}/bin/aichat --model ${llm.remote.key}:${llm.remote.models.fast.key}";
|
||||
codex_remote = "${pkgs.codex}/bin/codex --profile fast_remote";
|
||||
hotspot = "sudo sysctl net.ipv4.ip_default_ttl=65";
|
||||
};
|
||||
};
|
||||
starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
format =
|
||||
"[](red)"
|
||||
+ "$os"
|
||||
+ "$username"
|
||||
+ "[](bg:peach fg:red)"
|
||||
+ "$directory"
|
||||
+ "[](bg:yellow fg:peach)"
|
||||
+ "$git_branch"
|
||||
+ "$git_status"
|
||||
+ "[](fg:yellow bg:green)"
|
||||
+ "$c"
|
||||
+ "$rust"
|
||||
+ "$golang"
|
||||
+ "$nodejs"
|
||||
+ "$php"
|
||||
+ "$java"
|
||||
+ "$kotlin"
|
||||
+ "$haskell"
|
||||
+ "$python"
|
||||
+ "[](fg:green bg:sapphire)"
|
||||
+ "$conda"
|
||||
+ "$nix_shell"
|
||||
+ "[](fg:sapphire bg:lavender)"
|
||||
+ "$time"
|
||||
+ "[ ](fg:lavender)"
|
||||
+ "$cmd_duration"
|
||||
+ "$line_break"
|
||||
+ "$character";
|
||||
os = {
|
||||
disabled = false;
|
||||
style = "bg:red fg:crust";
|
||||
symbols = {
|
||||
Windows = "";
|
||||
Ubuntu = "";
|
||||
SUSE = "";
|
||||
Raspbian = "";
|
||||
Mint = "";
|
||||
Macos = "";
|
||||
Manjaro = "";
|
||||
Linux = "";
|
||||
Gentoo = "";
|
||||
Fedora = "";
|
||||
Alpine = "";
|
||||
Amazon = "";
|
||||
Android = "";
|
||||
Arch = "";
|
||||
Artix = "";
|
||||
CentOS = "";
|
||||
Debian = "";
|
||||
Redhat = "";
|
||||
RedHatEnterprise = "";
|
||||
NixOS = "";
|
||||
};
|
||||
};
|
||||
username = {
|
||||
show_always = true;
|
||||
style_user = "bg:red fg:crust";
|
||||
style_root = "bg:red fg:crust";
|
||||
format = ''[ $user]($style)'';
|
||||
};
|
||||
directory = {
|
||||
style = "bg:peach fg:crust";
|
||||
format = "[ $path ]($style)";
|
||||
truncation_length = 3;
|
||||
truncation_symbol = "…/";
|
||||
substitutions = {
|
||||
"Documents" = " ";
|
||||
"Downloads" = " ";
|
||||
"Music" = " ";
|
||||
"Pictures" = " ";
|
||||
"Developer" = " ";
|
||||
};
|
||||
};
|
||||
git_branch = {
|
||||
symbol = "";
|
||||
style = "bg:yellow";
|
||||
format = ''[[ $symbol $branch ](fg:crust bg:yellow)]($style)'';
|
||||
};
|
||||
git_status = {
|
||||
style = "bg:yellow";
|
||||
format = ''[[($all_status$ahead_behind )](fg:crust bg:yellow)]($style)'';
|
||||
};
|
||||
nodejs = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
c = {
|
||||
symbol = " ";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
rust = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
golang = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
php = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
java = {
|
||||
symbol = " ";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
kotlin = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
haskell = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
python = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version)(\(#$virtualenv\)) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
docker_context = {
|
||||
symbol = "";
|
||||
style = "bg:sapphire";
|
||||
format = ''[[ $symbol( $context) ](fg:crust bg:sapphire)]($style)'';
|
||||
};
|
||||
conda = {
|
||||
symbol = " ";
|
||||
style = "fg:crust bg:sapphire";
|
||||
format = ''[$symbol$environment ]($style)'';
|
||||
ignore_base = false;
|
||||
};
|
||||
nix_shell = {
|
||||
symbol = "";
|
||||
style = "fg:crust bg:sapphire";
|
||||
format = ''[[ $symbol( $name) ](fg:crust bg:sapphire)]($style)'';
|
||||
};
|
||||
time = {
|
||||
disabled = false;
|
||||
time_format = "%R";
|
||||
style = "bg:lavender";
|
||||
format = ''[[ $time ](fg:crust bg:lavender)]($style)'';
|
||||
};
|
||||
line_break = {
|
||||
disabled = false;
|
||||
};
|
||||
character = {
|
||||
disabled = false;
|
||||
success_symbol = "[❯](bold fg:green)";
|
||||
error_symbol = "[❯](bold fg:red)";
|
||||
vimcmd_symbol = "[❮](bold fg:green)";
|
||||
vimcmd_replace_one_symbol = "[❮](bold fg:lavender)";
|
||||
vimcmd_replace_symbol = "[❮](bold fg:lavender)";
|
||||
vimcmd_visual_symbol = "[❮](bold fg:yellow)";
|
||||
};
|
||||
cmd_duration = {
|
||||
show_milliseconds = true;
|
||||
format = " in $duration ";
|
||||
style = "bg:lavender";
|
||||
disabled = false;
|
||||
show_notifications = true;
|
||||
min_time_to_notify = 45000;
|
||||
};
|
||||
};
|
||||
};
|
||||
carapace = {
|
||||
enable = true;
|
||||
enableFishIntegration = false;
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
delta = {
|
||||
|
@ -391,211 +126,5 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
codex = {
|
||||
enable = true;
|
||||
# custom-instructions = ''
|
||||
# ## 10. Applying Patch Files with patch
|
||||
|
||||
# When the built-in `apply_patch` tool or `git apply` fails to apply a diff/patch file (especially if the file being patched contains special characters that might confuse simpler patch tools), the standard `patch` utility can be a more robust alternative.
|
||||
|
||||
# - **Patch File Format**: Ensure your patch file is in a standard unified diff format. Typically, these patches are generated with `git diff > my_feature.patch` or manually crafted. If the patch refers to files with `a/` and `b/` prefixes (e.g., `--- a/file.txt`, `+++ b/file.txt`), you'll use the `-p1` option.
|
||||
|
||||
# - **Creating the Patch File**: You can create a patch file using shell redirection, for example:
|
||||
|
||||
# ```bash`
|
||||
# cat <<'EOF' > fix_descriptive_name.patch
|
||||
# --- a/path/to/your/file.ext
|
||||
# +++ b/path/to/your/file.ext
|
||||
# @@ -line_num,num_lines +line_num,num_lines @@ context_or_change
|
||||
# -old_line_content
|
||||
# +new_line_content
|
||||
# EOF
|
||||
# ```
|
||||
|
||||
# *Important*: Ensure the `EOF` marker is on its own line with no trailing spaces.
|
||||
|
||||
# - **Applying the Patch**: Use the `patch` command via the `shell` tool. The `-p1` option strips the leading component from file paths in the patch file (`a/`, `b/`).
|
||||
|
||||
# ```
|
||||
# # Example: Apply a patch file
|
||||
# default_api.shell(command=["sh", "-c", "patch -p1 < fix_descriptive_name.patch"])
|
||||
# ```
|
||||
|
||||
# - **Verification**: After applying, always verify that the target file has been changed as expected (e.g., using `cat` or `git diff`).
|
||||
|
||||
# - **Cleanup**: Remove the patch file if it's no longer needed:
|
||||
|
||||
# ```
|
||||
# default_api.shell(command=["rm", "fix_descriptive_name.patch"])
|
||||
# ```
|
||||
# '';
|
||||
settings = {
|
||||
model = llm.remote.models.fast.key;
|
||||
model_provider = llm.remote.key;
|
||||
model_providers = {
|
||||
${llm.remote.key} = {
|
||||
name = llm.remote.name;
|
||||
base_url = llm.remote.url;
|
||||
env_key = llm.remote.env;
|
||||
};
|
||||
};
|
||||
profiles = {
|
||||
fast_remote = {
|
||||
model = llm.remote.models.fast.key;
|
||||
model_provider = llm.remote.key;
|
||||
};
|
||||
coding_remote = {
|
||||
model = llm.remote.models.coding.key;
|
||||
model_provider = llm.remote.key;
|
||||
};
|
||||
reasoning_remote = {
|
||||
model = llm.remote.models.reasoning.key;
|
||||
model_provider = llm.remote.key;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
opencode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
"$schema" = "https://opencode.ai/config.json";
|
||||
provider = {
|
||||
${llm.remote.key} = {
|
||||
npm = "@ai-sdk/openai-compatible";
|
||||
name = llm.remote.name;
|
||||
options = {
|
||||
baseURL = llm.remote.url;
|
||||
apiKey = "{env:${llm.remote.env}}";
|
||||
};
|
||||
models = {
|
||||
${llm.remote.models.fast.key} = (
|
||||
let
|
||||
model = llm.remote.models.fast;
|
||||
in
|
||||
{
|
||||
id = model.key;
|
||||
name = model.name;
|
||||
options = {
|
||||
tools = model.tools;
|
||||
${llm.remote.name} = {
|
||||
provider = {
|
||||
order = model.provider;
|
||||
allow_fallbacks = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
tool_call = model.tool_call;
|
||||
reasoning = model.reasoning;
|
||||
temperature = model.temperature;
|
||||
}
|
||||
);
|
||||
${llm.remote.models.coding.key} = (
|
||||
let
|
||||
model = llm.remote.models.coding;
|
||||
in
|
||||
{
|
||||
id = model.key;
|
||||
name = model.name;
|
||||
options = {
|
||||
tools = model.tools;
|
||||
${llm.remote.name} = {
|
||||
provider = {
|
||||
order = model.provider;
|
||||
allow_fallbacks = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
tool_call = model.tool_call;
|
||||
reasoning = model.reasoning;
|
||||
temperature = model.temperature;
|
||||
}
|
||||
);
|
||||
${llm.remote.models.reasoning.key} = (
|
||||
let
|
||||
model = llm.remote.models.reasoning;
|
||||
in
|
||||
{
|
||||
id = model.key;
|
||||
name = model.name;
|
||||
options = {
|
||||
tools = model.tools;
|
||||
${llm.remote.name} = {
|
||||
provider = {
|
||||
order = model.provider;
|
||||
allow_fallbacks = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
tool_call = model.tool_call;
|
||||
reasoning = model.reasoning;
|
||||
temperature = model.temperature;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
model = "${llm.remote.key}:${llm.remote.models.fast.key}";
|
||||
};
|
||||
};
|
||||
aichat = {
|
||||
enable = true;
|
||||
settings = {
|
||||
model = "${llm.remote.key}:${llm.remote.models.fast.key}";
|
||||
clients = [
|
||||
{
|
||||
type = "openai-compatible";
|
||||
name = llm.remote.key;
|
||||
api_base = llm.remote.url;
|
||||
models = [
|
||||
(
|
||||
let
|
||||
model = llm.remote.models.fast;
|
||||
in
|
||||
{
|
||||
name = model.key;
|
||||
supports_function_calling = model.tools;
|
||||
supports_vision = model.vision;
|
||||
}
|
||||
)
|
||||
(
|
||||
let
|
||||
model = llm.remote.models.coding;
|
||||
in
|
||||
{
|
||||
name = model.key;
|
||||
supports_function_calling = model.tools;
|
||||
supports_vision = model.vision;
|
||||
}
|
||||
)
|
||||
(
|
||||
let
|
||||
model = llm.remote.models.reasoning;
|
||||
in
|
||||
{
|
||||
name = model.key;
|
||||
supports_function_calling = model.tools;
|
||||
supports_vision = model.vision;
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
direnv = {
|
||||
enable = true;
|
||||
mise.enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
};
|
||||
services = {
|
||||
gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
pinentry = {
|
||||
package = pkgs.pinentry-tty;
|
||||
program = "pinentry";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
242
home-manager/shell.nix
Normal file
242
home-manager/shell.nix
Normal file
|
@ -0,0 +1,242 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ethan Reece <contact@ethanreece.com>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
{
|
||||
home.shell = {
|
||||
enableNushellIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
programs = {
|
||||
nix-your-shell = {
|
||||
enable = true;
|
||||
};
|
||||
eza = {
|
||||
enable = true;
|
||||
};
|
||||
fzf = {
|
||||
enable = true;
|
||||
};
|
||||
direnv = {
|
||||
enable = true;
|
||||
mise.enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
nushell = {
|
||||
enable = true;
|
||||
settings = {
|
||||
completions = {
|
||||
algorithm = "fuzzy";
|
||||
case_sensitive = false;
|
||||
external = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
# set -x ZATHURA_PLUGINS_PATH $GUIX_HOME/lib/zathura
|
||||
shellAliases = {
|
||||
hotspot = "sudo sysctl net.ipv4.ip_default_ttl=65";
|
||||
};
|
||||
};
|
||||
starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
format =
|
||||
"[](red)"
|
||||
+ "$os"
|
||||
+ "$username"
|
||||
+ "[](bg:peach fg:red)"
|
||||
+ "$directory"
|
||||
+ "[](bg:yellow fg:peach)"
|
||||
+ "$git_branch"
|
||||
+ "$git_status"
|
||||
+ "[](fg:yellow bg:green)"
|
||||
+ "$c"
|
||||
+ "$rust"
|
||||
+ "$golang"
|
||||
+ "$nodejs"
|
||||
+ "$php"
|
||||
+ "$java"
|
||||
+ "$kotlin"
|
||||
+ "$haskell"
|
||||
+ "$python"
|
||||
+ "[](fg:green bg:sapphire)"
|
||||
+ "$conda"
|
||||
+ "$nix_shell"
|
||||
+ "[](fg:sapphire bg:lavender)"
|
||||
+ "$time"
|
||||
+ "[ ](fg:lavender)"
|
||||
+ "$cmd_duration"
|
||||
+ "$line_break"
|
||||
+ "$character";
|
||||
os = {
|
||||
disabled = false;
|
||||
style = "bg:red fg:crust";
|
||||
symbols = {
|
||||
Windows = "";
|
||||
Ubuntu = "";
|
||||
SUSE = "";
|
||||
Raspbian = "";
|
||||
Mint = "";
|
||||
Macos = "";
|
||||
Manjaro = "";
|
||||
Linux = "";
|
||||
Gentoo = "";
|
||||
Fedora = "";
|
||||
Alpine = "";
|
||||
Amazon = "";
|
||||
Android = "";
|
||||
Arch = "";
|
||||
Artix = "";
|
||||
CentOS = "";
|
||||
Debian = "";
|
||||
Redhat = "";
|
||||
RedHatEnterprise = "";
|
||||
NixOS = "";
|
||||
};
|
||||
};
|
||||
username = {
|
||||
show_always = true;
|
||||
style_user = "bg:red fg:crust";
|
||||
style_root = "bg:red fg:crust";
|
||||
format = ''[ $user]($style)'';
|
||||
};
|
||||
directory = {
|
||||
style = "bg:peach fg:crust";
|
||||
format = "[ $path ]($style)";
|
||||
truncation_length = 3;
|
||||
truncation_symbol = "…/";
|
||||
substitutions = {
|
||||
"Documents" = " ";
|
||||
"Downloads" = " ";
|
||||
"Music" = " ";
|
||||
"Pictures" = " ";
|
||||
"Developer" = " ";
|
||||
};
|
||||
};
|
||||
git_branch = {
|
||||
symbol = "";
|
||||
style = "bg:yellow";
|
||||
format = ''[[ $symbol $branch ](fg:crust bg:yellow)]($style)'';
|
||||
};
|
||||
git_status = {
|
||||
style = "bg:yellow";
|
||||
format = ''[[($all_status$ahead_behind )](fg:crust bg:yellow)]($style)'';
|
||||
};
|
||||
nodejs = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
c = {
|
||||
symbol = " ";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
rust = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
golang = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
php = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
java = {
|
||||
symbol = " ";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
kotlin = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
haskell = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
python = {
|
||||
symbol = "";
|
||||
style = "bg:green";
|
||||
format = ''[[ $symbol( $version)(\(#$virtualenv\)) ](fg:crust bg:green)]($style)'';
|
||||
};
|
||||
docker_context = {
|
||||
symbol = "";
|
||||
style = "bg:sapphire";
|
||||
format = ''[[ $symbol( $context) ](fg:crust bg:sapphire)]($style)'';
|
||||
};
|
||||
conda = {
|
||||
symbol = " ";
|
||||
style = "fg:crust bg:sapphire";
|
||||
format = ''[$symbol$environment ]($style)'';
|
||||
ignore_base = false;
|
||||
};
|
||||
nix_shell = {
|
||||
symbol = "";
|
||||
style = "fg:crust bg:sapphire";
|
||||
format = ''[[ $symbol( $name) ](fg:crust bg:sapphire)]($style)'';
|
||||
};
|
||||
time = {
|
||||
disabled = false;
|
||||
time_format = "%R";
|
||||
style = "bg:lavender";
|
||||
format = ''[[ $time ](fg:crust bg:lavender)]($style)'';
|
||||
};
|
||||
line_break = {
|
||||
disabled = false;
|
||||
};
|
||||
character = {
|
||||
disabled = false;
|
||||
success_symbol = "[❯](bold fg:green)";
|
||||
error_symbol = "[❯](bold fg:red)";
|
||||
vimcmd_symbol = "[❮](bold fg:green)";
|
||||
vimcmd_replace_one_symbol = "[❮](bold fg:lavender)";
|
||||
vimcmd_replace_symbol = "[❮](bold fg:lavender)";
|
||||
vimcmd_visual_symbol = "[❮](bold fg:yellow)";
|
||||
};
|
||||
cmd_duration = {
|
||||
show_milliseconds = true;
|
||||
format = " in $duration ";
|
||||
style = "bg:lavender";
|
||||
disabled = false;
|
||||
show_notifications = true;
|
||||
min_time_to_notify = 45000;
|
||||
};
|
||||
};
|
||||
};
|
||||
carapace = {
|
||||
enable = true;
|
||||
enableFishIntegration = false;
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
services = {
|
||||
gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
pinentry = {
|
||||
package = pkgs.pinentry-tty;
|
||||
program = "pinentry";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue