tools working

This commit is contained in:
2025-07-17 14:21:19 -06:00
parent 3ed05918bf
commit 11049d9f73
2 changed files with 247 additions and 237 deletions

View File

@@ -6,52 +6,70 @@
outputs = { self, nixpkgs, flake-utils }: outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; }; let
pkgs = import nixpkgs { inherit system; };
opencodeConfig = {
"$schema" = "https://opencode.ai/config.json";
theme = "github";
provider = {
ollama = {
npm = "@ai-sdk/openai-compatible";
options = {
baseURL = "http://ai-snow.reindeer-pinecone.ts.net:11434/v1";
};
models = {
"llama3.1:70b" = { };
"deepseek-r1:70b" = { };
"mistral:latest" = { };
"qwen3:32b" = { };
};
};
};
mcp = {
playwright = {
type = "local";
command = [
"npx"
"-y"
"@playwright/mcp@latest"
"--executable-path"
"${pkgs.chromium}/bin/chromium"
"--no-sandbox"
];
};
sequential_thinking = {
type = "local";
command = [
"npx"
"-y"
"@modelcontextprotocol/server-sequential-thinking"
];
};
};
};
in { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [ bash glib glib.out uv nodejs_22 opencode ];
bash
glib
glib.out
chromium
uv
nodejs_22
opencode
];
}; };
packages.run = pkgs.writeShellScriptBin "run_flake" '' packages.run = pkgs.writeShellScriptBin "run_flake" ''
mkdir -p ~/.config/opencode mkdir -p ~/.config/opencode
cp ${self.packages.${system}.config_json} ~/.config/opencode/opencode.json cp ${
self.packages.${system}.config_json
} ~/.config/opencode/opencode.json
${pkgs.opencode}/bin/opencode ${pkgs.opencode}/bin/opencode
''; '';
packages.config_json = pkgs.writeTextFile { packages.config_json = pkgs.writeTextFile {
name = "config.json"; name = "config.json";
text = '' text = builtins.toJSON opencodeConfig;
{ };
"$schema": "https://opencode.ai/config.json", packages.opencodeInstance = pkgs.stdenv.mkDerivation {
"theme": "github", name = "opencode";
"mcp": { buildInputs = [ pkgs.opencode ];
"memory": { installPhase = ''
"type": "local", mkdir -p $out/bin
"command": [ "npx", "-y", "@modelcontextprotocol/server-memory" ] ln -s ${pkgs.opencode}/bin/opencode $out/bin/opencode
}, mkdir -p $out/config
"playwright": { cp ${self.packages.${system}.config_json} $out/config/opencode.json
"type": "local",
"command": [
"npx",
"-y",
"@playwright/mcp@latest",
"--executable-path",
"${pkgs.chromium}/bin/chromium",
"--no-sandbox"
]
},
"sequential_thinking": {
"type": "local",
"command": [ "npx", "-y", "@modelcontextprotocol/server-sequential-thinking"]
}
}
}
''; '';
}; };
}); });

View File

@@ -1,7 +1,10 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
nixgl = import (fetchTarball "https://github.com/nix-community/nixGL/archive/main.tar.gz") {}; opencodeFlake = import ../../flakes/opencode;
nixgl = import
(fetchTarball "https://github.com/nix-community/nixGL/archive/main.tar.gz")
{ };
in { in {
home.username = "alexm"; home.username = "alexm";
home.homeDirectory = "/home/alexm"; home.homeDirectory = "/home/alexm";
@@ -14,10 +17,7 @@ in {
kubectl kubectl
lazydocker lazydocker
traceroute traceroute
(with dotnetCorePackages; combinePackages [ (with dotnetCorePackages; combinePackages [ sdk_8_0 sdk_9_0 ])
sdk_8_0
sdk_9_0
])
nodejs_22 nodejs_22
parallel parallel
k0sctl k0sctl
@@ -42,6 +42,7 @@ in {
firefoxpwa firefoxpwa
bluetui bluetui
nixfmt nixfmt
opencodeFlake.packages.${pkgs.system}.opencodeInstance
]; ];
programs.firefox = { programs.firefox = {
@@ -50,81 +51,77 @@ in {
nativeMessagingHosts = [ pkgs.firefoxpwa ]; nativeMessagingHosts = [ pkgs.firefoxpwa ];
}; };
programs.direnv = { programs.direnv = { enable = true; };
enable = true; programs.ghostty = { enable = true; };
};
programs.ghostty = {
enable = true;
};
programs.fish = { programs.fish = {
enable = true; enable = true;
shellInit = '' shellInit = ''
# https://gist.github.com/thomd/7667642 # https://gist.github.com/thomd/7667642
export LS_COLORS=':di=95' export LS_COLORS=':di=95'
function commit function commit
git add --all git add --all
git commit -m "$argv" git commit -m "$argv"
git pull git pull
git push git push
end end
# have ctrl+backspace delete previous word # have ctrl+backspace delete previous word
bind \e\[3\;5~ kill-word bind \e\[3\;5~ kill-word
# have ctrl+delete delete following word # have ctrl+delete delete following word
bind \b backward-kill-word bind \b backward-kill-word
alias blue="bluetui" alias blue="bluetui"
set -U fish_user_paths ~/.local/bin $fish_user_paths set -U fish_user_paths ~/.local/bin $fish_user_paths
set -U fish_user_paths ~/bin $fish_user_paths set -U fish_user_paths ~/bin $fish_user_paths
set -U fish_user_paths ~/.dotnet $fish_user_paths set -U fish_user_paths ~/.dotnet $fish_user_paths
set -U fish_user_paths ~/.dotnet/tools $fish_user_paths set -U fish_user_paths ~/.dotnet/tools $fish_user_paths
set fish_pager_color_selected_background --background='00399c' set fish_pager_color_selected_background --background='00399c'
export VISUAL=vim export VISUAL=vim
export EDITOR="$VISUAL" export EDITOR="$VISUAL"
export DOTNET_WATCH_RESTART_ON_RUDE_EDIT=1 export DOTNET_WATCH_RESTART_ON_RUDE_EDIT=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_ROOT=${pkgs.dotnetCorePackages.sdk_8_0} export DOTNET_ROOT=${pkgs.dotnetCorePackages.sdk_8_0}
set -x LIBVIRT_DEFAULT_URI qemu:///system set -x LIBVIRT_DEFAULT_URI qemu:///system
set -x TERM xterm-256color # ghostty set -x TERM xterm-256color # ghostty
# https://github.com/DevAtDawn/gh-fish/blob/main/gh-copilot-alias.fish # https://github.com/DevAtDawn/gh-fish/blob/main/gh-copilot-alias.fish
function ghcs function ghcs
set -l FUNCNAME (status function) set -l FUNCNAME (status function)
set -l TARGET "shell" set -l TARGET "shell"
set -l GH_DEBUG "$GH_DEBUG" set -l GH_DEBUG "$GH_DEBUG"
set -l GH_HOST "$GH_HOST" set -l GH_HOST "$GH_HOST"
set -l __USAGE " set -l __USAGE "
Wrapper around \`gh copilot suggest\` to suggest a command based on a natural language description of the desired output effort. Wrapper around \`gh copilot suggest\` to suggest a command based on a natural language description of the desired output effort.
Supports executing suggested commands if applicable. Supports executing suggested commands if applicable.
USAGE USAGE
$FUNCNAME [flags] <prompt> $FUNCNAME [flags] <prompt>
FLAGS FLAGS
-d, --debug Enable debugging -d, --debug Enable debugging
-h, --help Display help usage -h, --help Display help usage
--hostname The GitHub host to use for authentication --hostname The GitHub host to use for authentication
-t, --target target Target for suggestion; must be shell, gh, git -t, --target target Target for suggestion; must be shell, gh, git
default: \"$TARGET\" default: \"$TARGET\"
EXAMPLES EXAMPLES
- Guided experience - Guided experience
$FUNCNAME $FUNCNAME
- Git use cases - Git use cases
$FUNCNAME -t git \"Undo the most recent local commits\" $FUNCNAME -t git \"Undo the most recent local commits\"
$FUNCNAME -t git \"Clean up local branches\" $FUNCNAME -t git \"Clean up local branches\"
$FUNCNAME -t git \"Setup LFS for images\" $FUNCNAME -t git \"Setup LFS for images\"
- Working with the GitHub CLI in the terminal - Working with the GitHub CLI in the terminal
$FUNCNAME -t gh \"Create pull request\" $FUNCNAME -t gh \"Create pull request\"
$FUNCNAME -t gh \"List pull requests waiting for my review\" $FUNCNAME -t gh \"List pull requests waiting for my review\"
$FUNCNAME -t gh \"Summarize work I have done in issues and pull requests for promotion\" $FUNCNAME -t gh \"Summarize work I have done in issues and pull requests for promotion\"
- General use cases - General use cases
$FUNCNAME \"Kill processes holding onto deleted files\" $FUNCNAME \"Kill processes holding onto deleted files\"
$FUNCNAME \"Test whether there are SSL/TLS issues with github.com\" $FUNCNAME \"Test whether there are SSL/TLS issues with github.com\"
$FUNCNAME \"Convert SVG to PNG and resize\" $FUNCNAME \"Convert SVG to PNG and resize\"
$FUNCNAME \"Convert MOV to animated PNG\" $FUNCNAME \"Convert MOV to animated PNG\"
" "
set -l argv_copy $argv set -l argv_copy $argv
for i in (seq (count $argv_copy)) for i in (seq (count $argv_copy))
@@ -161,24 +158,22 @@ EXAMPLES
else else
return 1 return 1
end end
end end
function plz function plz
ghcs suggest "$argv" ghcs suggest "$argv"
end end
fish_add_path /home/alexm/.opencode/bin
''; '';
}; };
home.file = { home.file = {
".config/lazydocker/config.yml".text = '' ".config/lazydocker/config.yml".text = ''
gui: gui:
returnImmediately: true returnImmediately: true
screenMode: "half" screenMode: "half"
''; '';
".config/k9s/config.yaml".text = '' ".config/k9s/config.yaml".text = ''
k9s: k9s:
liveViewAutoRefresh: true liveViewAutoRefresh: true
screenDumpDir: /home/alexm/.local/state/k9s/screen-dumps screenDumpDir: /home/alexm/.local/state/k9s/screen-dumps
refreshRate: 2 refreshRate: 2
@@ -222,51 +217,47 @@ k9s:
namespace: namespace:
lockFavorites: false''; lockFavorites: false'';
".local/share/applications/firefox.desktop".text = ''[Desktop Entry] ".local/share/applications/firefox.desktop".text = ''
Version=1.0 [Desktop Entry]
Type=Application Version=1.0
Name=Firefox Type=Application
Comment=Browse the Web Name=Firefox
Exec=firefox %u Comment=Browse the Web
Icon=firefox Exec=firefox %u
Terminal=false Icon=firefox
Categories=Network;WebBrowser; Terminal=false
MimeType=x-scheme-handler/http;x-scheme-handler/https;text/html; Categories=Network;WebBrowser;
StartupWMClass=firefox MimeType=x-scheme-handler/http;x-scheme-handler/https;text/html;
Actions=new-window;new-private-window; StartupWMClass=firefox
Actions=new-window;new-private-window;
[Desktop Action new-window] [Desktop Action new-window]
Name=Open a New Window Name=Open a New Window
Exec=firefox --new-window Exec=firefox --new-window
[Desktop Action new-private-window] [Desktop Action new-private-window]
Name=Open a New Private Window Name=Open a New Private Window
Exec=firefox --private-window Exec=firefox --private-window
''; '';
".local/share/applications/teams.desktop".text = ''[Desktop Entry] ".local/share/applications/teams.desktop".text = ''
Version=1.0 [Desktop Entry]
Type=Application Version=1.0
Name=Microsoft Teams (Web) Type=Application
Comment=Launch Microsoft Teams in Firefox Name=Microsoft Teams (Web)
Exec=firefox --new-window https://teams.microsoft.com Comment=Launch Microsoft Teams in Firefox
Icon=teams Exec=firefox --new-window https://teams.microsoft.com
Terminal=false Icon=teams
Categories=Network;WebBrowser; Terminal=false
''; Categories=Network;WebBrowser;
'';
}; };
home.sessionVariables = { home.sessionVariables = { EDITOR = "vim"; };
EDITOR = "vim";
};
dconf.enable = true; dconf.enable = true;
dconf.settings = { dconf.settings = {
"org/gnome/desktop/wm/keybindings" = { "org/gnome/desktop/wm/keybindings" = { toggle-maximized = [ "<Super>m" ]; };
toggle-maximized=["<Super>m"]; "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; };
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
"org/gnome/settings-daemon/plugins/media-keys" = { "org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [ custom-keybindings = [
@@ -274,7 +265,8 @@ Categories=Network;WebBrowser;
]; ];
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" =
{
name = "Launch Ghostty"; name = "Launch Ghostty";
command = "nixGL ghostty"; command = "nixGL ghostty";
binding = "<Super>t"; binding = "<Super>t";