Merge pull request 'Updates and added aider derivation' (#9) from push-loprumvkmlkr into main

Reviewed-on: #9
This commit is contained in:
Salar Rahmanian 2025-03-02 19:37:40 -08:00
commit 8ebee52022
10 changed files with 278 additions and 92 deletions

30
flake.lock generated
View file

@ -28,11 +28,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1738428726, "lastModified": 1740845322,
"narHash": "sha256-OUoEgorFHBVnqQ2lITqs6MGN7MH4t/8hLEO29OKu6CM=", "narHash": "sha256-AXEgFj3C0YJhu9k1OhbRhiA6FnDr81dQZ65U3DhaWpw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "dae6d3460c8bab3ac9f38a86affe45b32818e764", "rev": "fcac3d6d88302a5e64f6cb8014ac785e08874c8d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -48,11 +48,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1738277753, "lastModified": 1740755725,
"narHash": "sha256-iyFcCOk0mmDiv4ut9mBEuMxMZIym3++0qN1rQBg8FW0=", "narHash": "sha256-amZbqP84H/ApugaT+TADXTB3NbjkVHI9Vac1saIk0kE=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "49b807fa7c37568d7fbe2aeaafb9255c185412f9", "rev": "5d6e0851b60508cffd66b4a6982440a40720338d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -63,11 +63,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1738142207, "lastModified": 1740828860,
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", "narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40", "rev": "303bd8071377433a2d8f76e684ec773d70c5b642",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -79,11 +79,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1738142207, "lastModified": 1740828860,
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", "narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40", "rev": "303bd8071377433a2d8f76e684ec773d70c5b642",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -100,11 +100,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1738362438, "lastModified": 1740968044,
"narHash": "sha256-EO2dVkMVLThWqv4hobEZEZGWBEuH2Z9SYqQDrbLSclU=", "narHash": "sha256-nvDJeg1CZHl5LfzSjF0fg4vN43yWi11g0l+fqCPrPsY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nur", "repo": "nur",
"rev": "95ddad0ff0e67c90314c6ca46324dce5f9a910d2", "rev": "27c215df50e54f048a03616eb9fc20190e5d71f5",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -43,8 +43,6 @@
packages = with pkgs; [ fira-code ]; packages = with pkgs; [ fira-code ];
}; };
services.nix-daemon.enable = true;
nix = { nix = {
nixPath = nixpkgs.lib.mkForce [ "nixpkgs=${nixpkgs}" ]; nixPath = nixpkgs.lib.mkForce [ "nixpkgs=${nixpkgs}" ];

View file

@ -210,6 +210,6 @@
# Neovim Configuration # Neovim Configuration
xdg.configFile."nvim".source = builtins.fetchGit { xdg.configFile."nvim".source = builtins.fetchGit {
url = "https://code.softinio.com/softinio/nvim-config"; url = "https://code.softinio.com/softinio/nvim-config";
rev = "b205894edc350b5fe1b939939461b4e713478b97"; rev = "e609be92393f89856d850e9cc3aa23c7badf0bee";
}; };
} }

View file

@ -0,0 +1,204 @@
{ lib, pkgs, ... }:
let
python3 = pkgs.python312.override {
self = python3;
packageOverrides = _: super: { tree-sitter = super.tree-sitter_0_21; };
};
version = "0.74.1";
aider-chat = python3.pkgs.buildPythonPackage {
pname = "aider-chat";
inherit version;
pyproject = true;
src = pkgs.fetchFromGitHub {
owner = "Aider-AI";
repo = "aider";
tag = "v${version}";
hash = "sha256-JXzkvuSOOEUxNqF6l5USzIPftpnIW+CptEv/0yp0eGM=";
};
pythonRelaxDeps = true;
build-system = with python3.pkgs; [ setuptools-scm ];
dependencies = with python3.pkgs; [
aiohappyeyeballs
aiohttp
aiosignal
annotated-types
anyio
attrs
backoff
beautifulsoup4
certifi
cffi
charset-normalizer
click
configargparse
diff-match-patch
diskcache
distro
filelock
flake8
frozenlist
fsspec
gitdb
gitpython
grep-ast
h11
httpcore
httpx
huggingface-hub
idna
importlib-resources
jinja2
jiter
json5
jsonschema
jsonschema-specifications
litellm
markdown-it-py
markupsafe
mccabe
mdurl
multidict
networkx
numpy
openai
packaging
pathspec
pexpect
pillow
prompt-toolkit
psutil
ptyprocess
pycodestyle
pycparser
pydantic
pydantic-core
pydub
pyflakes
pygments
pypandoc
pyperclip
python-dotenv
pyyaml
referencing
regex
requests
rich
rpds-py
scipy
smmap
sniffio
sounddevice
soundfile
soupsieve
tiktoken
tokenizers
tqdm
tree-sitter
tree-sitter-languages
typing-extensions
urllib3
watchfiles
wcwidth
yarl
zipp
pip
# Not listed in requirements
mixpanel
monotonic
posthog
propcache
python-dateutil
];
buildInputs = [ pkgs.portaudio ];
nativeCheckInputs = (with python3.pkgs; [ pytestCheckHook ]) ++ [ pkgs.gitMinimal ];
disabledTestPaths = [
# Tests require network access
"tests/scrape/test_scrape.py"
# Expected 'mock' to have been called once
"tests/help/test_help.py"
];
disabledTests =
[
# Tests require network
"test_urls"
"test_get_commit_message_with_custom_prompt"
# FileNotFoundError
"test_get_commit_message"
# Expected 'launch_gui' to have been called once
"test_browser_flag_imports_streamlit"
# AttributeError
"test_simple_send_with_retries"
# Expected 'check_version' to have been called once
"test_main_exit_calls_version_check"
# AssertionError: assert 2 == 1
"test_simple_send_non_retryable_error"
]
++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
# Tests fails on darwin
"test_dark_mode_sets_code_theme"
"test_default_env_file_sets_automatic_variable"
# FileNotFoundError: [Errno 2] No such file or directory: 'vim'
"test_pipe_editor"
];
makeWrapperArgs = [
"--set AIDER_CHECK_UPDATE false"
"--set AIDER_ANALYTICS false"
];
preCheck = ''
export HOME=$(mktemp -d)
export AIDER_ANALYTICS="false"
'';
optional-dependencies = with python3.pkgs; {
playwright = [
greenlet
playwright
pyee
typing-extensions
];
};
passthru = {
withPlaywright = aider-chat.overridePythonAttrs (
{
dependencies,
buildInputs,
makeWrapperArgs,
...
}:
{
dependencies = dependencies ++ aider-chat.optional-dependencies.playwright;
buildInputs = buildInputs ++ [ pkgs.playwright-driver.browsers ];
makeWrapperArgs = makeWrapperArgs ++ [
"--set PLAYWRIGHT_BROWSERS_PATH ${pkgs.playwright-driver.browsers}"
"--set PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true"
];
}
);
};
meta = {
description = "AI pair programming in your terminal";
homepage = "https://github.com/paul-gauthier/aider";
changelog = "https://github.com/paul-gauthier/aider/blob/v${version}/HISTORY.md";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ happysalada ];
mainProgram = "aider";
};
};
in
aider-chat

View file

@ -23,8 +23,8 @@
## Use claude-3-opus-20240229 model for the main chat ## Use claude-3-opus-20240229 model for the main chat
#opus: false #opus: false
## Use claude-3-5-sonnet-20241022 model for the main chat ## Use anthropic/claude-3-7-sonnet-20250219 model for the main chat
#sonnet: false sonnet: true
## Use claude-3-5-haiku-20241022 model for the main chat ## Use claude-3-5-haiku-20241022 model for the main chat
#haiku: false #haiku: false
@ -33,7 +33,7 @@
#4: false #4: false
## Use gpt-4o model for the main chat ## Use gpt-4o model for the main chat
4o: true # 4o: true
## Use gpt-4o-mini model for the main chat ## Use gpt-4o-mini model for the main chat
#mini: false #mini: false
@ -429,7 +429,7 @@ vim: true
#fancy-input: true #fancy-input: true
## Enable/disable multi-line input mode with Meta-Enter to submit (default: False) ## Enable/disable multi-line input mode with Meta-Enter to submit (default: False)
multiline: true multiline: false
## Enable/disable detection and offering to add URLs to chat (default: True) ## Enable/disable detection and offering to add URLs to chat (default: True)
#detect-urls: true #detect-urls: true

View file

@ -1,17 +1,12 @@
{ pkgs, ... }: { lib, pkgs, ... }:
let let
aiderConfig = builtins.readFile ./aider.yml; aiderConfig = builtins.readFile ./aider.yml;
aiderPkgs = import ./aider-deriv.nix { inherit lib pkgs; };
in in
{ {
home.packages = with pkgs; [ home.packages = [
aider-chat aiderPkgs.withPlaywright
streamlit
python3Packages.greenlet
python3Packages.llama-index-core
python3Packages.llama-index-embeddings-huggingface
python3Packages.playwright
python3Packages.watchdog
]; ];
home.file.".aider.conf.yml".text = aiderConfig; home.file.".aider.conf.yml".text = aiderConfig;
} }

View file

@ -7,11 +7,17 @@
fishPlugins.bobthefish fishPlugins.bobthefish
]; ];
home.shell.enableFishIntegration = true;
programs.fish = { programs.fish = {
enable = true; enable = true;
functions = { functions = {
gitignore = "curl -sL https://www.gitignore.io/api/$argv"; gitignore = "curl -sL https://www.gitignore.io/api/$argv";
ot = ''
set otresult (ollama run qwen2.5-coder "Provide only the MacOS terminal command (without markdown) to: $argv")
commandline $otresult
'';
}; };
plugins = [ plugins = [
@ -26,7 +32,7 @@
} }
]; ];
loginShellInit = '' shellInitLast = ''
set -xg TERM xterm-256color set -xg TERM xterm-256color
if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
@ -40,7 +46,7 @@
fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
end end
set -xg PATH /Applications/Ghostty.app/Contents/MacOS $HOME/bin $HOME/.cargo/bin /Users/salar/.luarocks/bin:/Users/salar/bin:/Users/salar/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin $PATH set -xg PATH /Applications/Ghostty.app/Contents/MacOS $HOME/bin $HOME/.cargo/bin $HOME/.npm-global/bin /Users/salar/.luarocks/bin:/Users/salar/bin:/Users/salar/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin $PATH
set -xg WORKSPACE /Users/salar/Projects set -xg WORKSPACE /Users/salar/Projects
@ -49,6 +55,7 @@
set -xg TOOLCHAINS swift set -xg TOOLCHAINS swift
set -xg OPENAI_API_KEY (cat ~/.openai) set -xg OPENAI_API_KEY (cat ~/.openai)
set -xg ANTHROPIC_API_KEY (cat ~/.anthropic)
''; '';
interactiveShellInit = '' interactiveShellInit = ''
@ -83,6 +90,7 @@
nixq = "nix-env -qa"; nixq = "nix-env -qa";
nixstorerepair = "nix-store --repair --verify --check-contents"; nixstorerepair = "nix-store --repair --verify --check-contents";
nixupgrade = "nix upgrade-nix"; nixupgrade = "nix upgrade-nix";
o = "echo (ollama run qwen2.5-coder \"Provide only the MacOS terminal command (without markdown) to: $argv\")";
rmxcodederived = "rm -fr ~/Library/Developer/Xcode/DerivedData"; rmxcodederived = "rm -fr ~/Library/Developer/Xcode/DerivedData";
v = "nvim"; v = "nvim";
sshhcloud1 = "ssh salar@hcloud1.softinio.net"; sshhcloud1 = "ssh salar@hcloud1.softinio.net";

View file

@ -0,0 +1,21 @@
{ pkgs, ... }:
let
mySettings = {
copy-on-select = "clipboard";
font-family = "SF Mono";
font-size = 16;
macos-title-bar-style = "transparent";
theme = "Builtin Tango Dark";
window-inherit-working-directory = true;
working-directory = "home";
};
in
{
programs.ghostty = {
enable = true;
enableFishIntegration = true;
installBatSyntax = true;
installVimSyntax = true;
settings = mySettings;
};
}

View file

@ -6,7 +6,6 @@ let
baccata.scaladex-search baccata.scaladex-search
charliermarsh.ruff charliermarsh.ruff
davidanson.vscode-markdownlint davidanson.vscode-markdownlint
enkia.tokyo-night
github.copilot github.copilot
github.copilot-chat github.copilot-chat
github.github-vscode-theme github.github-vscode-theme
@ -20,16 +19,15 @@ let
ms-python.debugpy ms-python.debugpy
ms-python.python ms-python.python
ms-python.vscode-pylance ms-python.vscode-pylance
ms-toolsai.datawrangler
ms-toolsai.jupyter ms-toolsai.jupyter
ms-toolsai.jupyter-keymap ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers ms-toolsai.jupyter-renderers
ms-toolsai.vscode-jupyter-cell-tags ms-toolsai.vscode-jupyter-cell-tags
ms-toolsai.vscode-jupyter-slideshow ms-toolsai.vscode-jupyter-slideshow
ms-vscode.makefile-tools ms-vscode.makefile-tools
ms-toolsai.jupyter
redhat.java redhat.java
redhat.vscode-yaml redhat.vscode-yaml
rust-lang.rust-analyzer
scalameta.metals scalameta.metals
skyapps.fish-vscode skyapps.fish-vscode
sswg.swift-lang sswg.swift-lang
@ -40,7 +38,6 @@ let
visualjj.visualjj visualjj.visualjj
vscode-icons-team.vscode-icons vscode-icons-team.vscode-icons
vscjava.vscode-java-pack vscjava.vscode-java-pack
xyz.local-history
yzhang.markdown-all-in-one yzhang.markdown-all-in-one
]; ];
myUserSettings = { myUserSettings = {
@ -74,8 +71,8 @@ let
"editor.defaultFormatter" = "charliermarsh.ruff"; "editor.defaultFormatter" = "charliermarsh.ruff";
"editor.formatOnSave" = true; "editor.formatOnSave" = true;
"editor.codeActionsOnSave" = { "editor.codeActionsOnSave" = {
"source.fixAll" = "afterDelay"; "source.fixAll" = "always";
"source.organizeImports" = "afterDelay"; "source.organizeImports" = "always";
}; };
}; };
"telemetry.telemetryLevel" = "off"; "telemetry.telemetryLevel" = "off";
@ -85,7 +82,7 @@ let
"update.mode" = "none"; "update.mode" = "none";
"vsicons.dontShowNewVersionMessage" = true; "vsicons.dontShowNewVersionMessage" = true;
"window.openFoldersInNewWindow" = "on"; "window.openFoldersInNewWindow" = "on";
"workbench.colorTheme" = "Tokyo Night"; "workbench.colorTheme" = "GitHub Dark Default";
"workbench.iconTheme" = "vscode-icons"; "workbench.iconTheme" = "vscode-icons";
"workbench.sideBar.location" = "right"; "workbench.sideBar.location" = "right";
}; };
@ -93,10 +90,14 @@ in
{ {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
enableUpdateCheck = false; profiles = {
enableExtensionUpdateCheck = false; default = {
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
extensions = myExtensions;
userSettings = myUserSettings;
};
};
mutableExtensionsDir = false; mutableExtensionsDir = false;
extensions = myExtensions;
userSettings = myUserSettings;
}; };
} }

View file

@ -2,39 +2,6 @@ local wezterm = require 'wezterm'
local mux = wezterm.mux local mux = wezterm.mux
local act = wezterm.action local act = wezterm.action
local function is_vim(pane)
-- this is set by the plugin, and unset on ExitPre in Neovim
return pane:get_user_vars().IS_NVIM == 'true'
end
local direction_keys = {
a = 'Left',
o = 'Down',
e = 'Up',
u = 'Right',
}
local function split_nav(resize_or_move, key)
return {
key = key,
mods = resize_or_move == 'resize' and 'META' or 'CTRL',
action = wezterm.action_callback(function(win, pane)
if is_vim(pane) then
-- pass the keys through to vim/nvim
win:perform_action({
SendKey = { key = key, mods = resize_or_move == 'resize' and 'META' or 'CTRL' },
}, pane)
else
if resize_or_move == 'resize' then
win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane)
else
win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
end
end
end),
}
end
wezterm.on('update-right-status', function(window, pane) wezterm.on('update-right-status', function(window, pane)
window:set_right_status(window:active_workspace()) window:set_right_status(window:active_workspace())
end) end)
@ -49,8 +16,9 @@ return {
adjust_window_size_when_changing_font_size = false, adjust_window_size_when_changing_font_size = false,
check_for_updates = false, check_for_updates = false,
-- color_scheme = "Gruvbox Light"; -- color_scheme = "Gruvbox Light";
color_scheme = 'tokyonight', -- color_scheme = 'tokyonight',
default_gui_startup_args = { 'connect', 'unix' }, color_scheme = 'Tango (terminal.sexy)',
-- default_gui_startup_args = { 'connect', 'unix' },
font = wezterm.font 'SF Mono', font = wezterm.font 'SF Mono',
font_size = 16, font_size = 16,
dpi = 144, dpi = 144,
@ -59,6 +27,8 @@ return {
initial_rows = 80, initial_rows = 80,
leader = { key = 'b', mods = 'SUPER', timeout_milliseconds = 1000 }, leader = { key = 'b', mods = 'SUPER', timeout_milliseconds = 1000 },
default_prog = { '/etc/profiles/per-user/salar/bin/fish' }, default_prog = { '/etc/profiles/per-user/salar/bin/fish' },
window_decorations = 'RESIZE',
-- window_background_image = '/Users/salar/.config/nixpkgs/programs/wezterm/bridge.jpg',
ssh_domains = { ssh_domains = {
{ {
name = 'hcloud1', name = 'hcloud1',
@ -70,6 +40,7 @@ return {
unix_domains = { unix_domains = {
{ {
name = 'unix', name = 'unix',
proxy_command = { 'nc', '-U', '/Users/salar/.local/share/wezterm/sock' },
}, },
}, },
keys = { keys = {
@ -95,7 +66,7 @@ return {
{ key = '9', mods = 'LEADER', action = wezterm.action { ActivateTab = 8 } }, { key = '9', mods = 'LEADER', action = wezterm.action { ActivateTab = 8 } },
{ key = '&', mods = 'LEADER', action = wezterm.action { CloseCurrentTab = { confirm = true } } }, { key = '&', mods = 'LEADER', action = wezterm.action { CloseCurrentTab = { confirm = true } } },
{ key = 'x', mods = 'LEADER', action = wezterm.action { CloseCurrentPane = { confirm = true } } }, { key = 'x', mods = 'LEADER', action = wezterm.action { CloseCurrentPane = { confirm = true } } },
{ key = 'Enter', mods = 'ALT', action = act.ToggleFullScreen }, { key = 'Enter', mods = 'ALT', action = act.DisableDefaultAssignment },
{ key = 'c', mods = 'SUPER', action = act.CopyTo 'Clipboard' }, { key = 'c', mods = 'SUPER', action = act.CopyTo 'Clipboard' },
{ key = 'v', mods = 'SUPER', action = act.PasteFrom 'Clipboard' }, { key = 'v', mods = 'SUPER', action = act.PasteFrom 'Clipboard' },
{ key = 'n', mods = 'SUPER', action = act.SpawnWindow }, { key = 'n', mods = 'SUPER', action = act.SpawnWindow },
@ -155,17 +126,5 @@ return {
}, },
}, },
{ key = 'Tab', mods = 'CTRL', action = wezterm.action.DisableDefaultAssignment }, { key = 'Tab', mods = 'CTRL', action = wezterm.action.DisableDefaultAssignment },
-- move between split panes
split_nav('move', 'a'),
split_nav('move', 'o'),
split_nav('move', 'e'),
split_nav('move', 'u'),
-- resize panes
split_nav('resize', 'a'),
split_nav('resize', 'o'),
split_nav('resize', 'e'),
split_nav('resize', 'u'),
}, },
-- temp fix
-- front_end = 'WebGpu',
} }