This commit is contained in:
root 2026-05-02 10:03:39 -03:00
parent 73ff9ee8ee
commit 664eb70e8c
No known key found for this signature in database
14 changed files with 698 additions and 495 deletions

200
home/agents.nix Normal file
View file

@ -0,0 +1,200 @@
{ pkgs, lib, ... }:
let
home-manager-config =
{
uid,
username,
}:
let
HOME = "/home/${username}";
in
{
${username} =
{ config, ... }:
{
imports = [
./nvim
./tmux.nix
];
home.username = username;
home.homeDirectory = "${HOME}";
home.stateVersion = "25.11";
home.enableNixpkgsReleaseCheck = false;
home.sessionVariables = {
DISPLAY = ":1";
};
programs = {
chromium.enable = true;
claude-code.enable = true;
opencode.enable = true;
ssh = {
enable = true;
enableDefaultConfig = false;
matchBlocks = {
"*" = {
serverAliveInterval = 60;
serverAliveCountMax = 3;
};
"github.com" = {
identityFile = "${HOME}/.ssh/id_ed25519";
};
};
};
delta = {
enable = true;
options = {
navigate = true;
line-numbers = true;
side-by-side = true;
};
enableGitIntegration = true;
};
git = {
enable = true;
lfs.enable = true;
signing = {
key = "${HOME}/.ssh/id_ed25519.pub";
signByDefault = true;
};
includes = [
{
condition = "gitdir:~/dealwise/";
contents = {
user = {
name = "felipematos";
email = "5471818+fnzr@users.noreply.github.com";
signingkey = "${HOME}/.ssh/id_ed25519.pub";
};
};
}
{
contents = {
user = {
name = "${username}";
email = "${username}@sandbox.dev";
signingkey = "${HOME}/.ssh/id_ed25519.pub";
};
};
}
];
settings = {
user = {
email = "${username}@sandbox.dev";
name = "${username}";
signingkey = "${HOME}/.ssh/id_ed25519.pub";
};
gpg.format = "ssh";
commit.gpgsign = true;
tag.gpgsign = true;
core = {
editor = "nvim";
whitespace = "fix,only-indent-error,trailing-space,space-before-tab";
quotepath = false;
};
diff = {
algorithm = "histogram";
renames = "copies";
tool = "nvim";
};
difftool = {
prompt = false;
nvim.cmd = "nvim -d $LOCAL $REMOTE";
};
merge = {
conflictstyle = "zdiff3";
tool = "nvim";
};
mergetool = {
prompt = false;
keepBackup = false;
nvim.cmd = "nvim -d $LOCAL $REMOTE $MERGED -c 'wincmd w' -c 'wincmd J'";
};
init = {
defaultBranch = "master";
};
push = {
autoSetupRemote = true;
default = "current";
};
pull = {
rebase = true;
};
fetch = {
prune = true;
};
help = {
autocorrect = "prompt";
};
};
};
fish = {
enable = true;
plugins = [
{
name = "puffer";
src = pkgs.fetchFromGitHub {
owner = "nickeb96";
repo = "puffer-fish";
rev = "83174b0";
sha256 = "sha256-Dhx5+XRxJvlhdnFyimNxFyFiASrGU4ZwyefsDwtKnSg=";
};
}
];
interactiveShellInit = ''
set fish_greeting
bind ctrl-space ""
'';
};
starship.enable = true;
};
custom.tmux.enable = true;
custom.neovim = {
enable = true;
colorscheme = "rose-pine-moon";
hostname = "amelia";
};
xdg.configFile."containers/containers.conf".text = ''
[engine]
compose_warning_logs=false
events_logger="file"
[containers]
log_driver="k8s-file"
'';
xdg.configFile."opencode/opencode.json".text = builtins.toJSON {
"$schema" = "https://opencode.ai/config.json";
plugin = [ "opencode-antigravity-auth@latest" ];
# {
# "provider": "ollama",
# "ollama": {
# "base_url": "http://localhost:11434",
# "model": "llama3.2"
# }
# }
provider = {
ollama = {
model = "qwen3.6";
base_url = "http://localhost:11434";
};
};
};
xdg.userDirs = {
enable = true;
extraConfig = {
XDG_CACHE_HOME = "$HOME/.cache";
};
};
};
};
in
{
home-manager.users = lib.mkMerge [
(home-manager-config {
uid = 1002;
username = "agent";
})
];
}

View file

@ -86,6 +86,7 @@ in
blade = { "blade-formatter" },
go = { "gofmt" },
wgsl = { "wgsl_fmt" },
odin = { "odinfmt" },
},
})
vim.api.nvim_create_autocmd("BufWritePre", {
@ -127,7 +128,14 @@ in
},
adapters = {
require('neotest-pest'),
}
require('neotest-zig'),
-- require('neotest-odin'),
},
watch = {
filter_path = function(path, root)
return true
end,
},
})
vim.keymap.set('n', '<localleader>pn', function() require('neotest').run.run() end, { desc = "test nearest" })
vim.keymap.set('n', '<localleader>pe', function() require('neotest').run.run(vim.fn.expand('%')) end, { desc = "test file" })
@ -138,6 +146,10 @@ in
type = "lua";
}
# {
# plugin = neotest-zig;
# type = "lua";
# }
# {
# plugin = nvim-autopairs;
# type = "lua";
# config = ''
@ -149,19 +161,43 @@ in
type = "lua";
config = ''
local dap = require("dap")
dap.adapters.php = {
type = 'executable',
command = '${pkgs.nodejs}/bin/node',
args = { '${pkgs.vscode-extensions.xdebug.php-debug}/share/vscode/extensions/xdebug.php-debug/out/phpDebug.js' },
dap.adapters = {
php = {
type = "executable",
command = "${pkgs.nodejs}/bin/node",
args = { "${pkgs.vscode-extensions.xdebug.php-debug}/share/vscode/extensions/xdebug.php-debug/out/phpDebug.js" },
},
codelldb = {
type = "server",
port = "''${port}",
executable = {
command = '${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb',
args = { "--port", "''${port}" },
},
},
}
dap.configurations.php = {
{
type = 'php',
request = 'launch',
name = 'listen for xdebug',
port = 9003,
}
dap.configurations = {
php = {
{
type = 'php',
request = 'launch',
name = 'listen for xdebug',
port = 9003,
}
},
zig = {
{
name = 'launch',
type = 'codelldb',
request = 'launch',
program = "''${workspaceFolder}/zig-out/bin/''${workspaceFolderBasename}",
cwd = "''${workspaceFolder}",
stopOnEntry = false,
args = {},
}
},
}
'';
}
@ -199,7 +235,7 @@ in
'fsharp', 'git_config', 'git_rebase', 'gitignore', 'glsl', 'go', 'gomod', 'graphql',
'haskell', 'hlsl', 'http', 'ini', 'javadoc', 'jq', 'jsdoc', 'json', 'json5', 'kitty',
'latex', 'markdown', 'nginx', 'nix', 'php', 'php_only', 'phpdoc', 'regex', 'rust', 'sql',
'ssh_config', 'tmux', 'vim', 'wgsl', 'yaml', 'zig', 'ols',
'ssh_config', 'tmux', 'vim', 'wgsl', 'yaml', 'zig', 'odin',
},
callback = function()
vim.treesitter.start()
@ -246,12 +282,11 @@ in
config = ''
vim.o.autoread = true
-- Recommended/example keymaps.
vim.keymap.set({ "n", "x" }, "<C-a>", function() require("opencode").ask("@this: ", { submit = true }) end, { desc = "Ask opencode" })
vim.keymap.set({ "n", "x" }, "<leader>h", function() require("opencode").ask("@this: ", { submit = true }) end, { desc = "Ask opencode" })
vim.keymap.set({ "n", "x" }, "<C-x>", function() require("opencode").select() end, { desc = "Execute opencode action" })
vim.keymap.set({ "n", "t" }, "<C-.>", function() require("opencode").toggle() end, { desc = "Toggle opencode" })
vim.keymap.set({ "n", "x" }, "go", function() return require("opencode").operator("@this ") end, { desc = "Add range to opencode", expr = true })
vim.keymap.set("n", "goo", function() return require("opencode").operator("@this ") .. "_" end, { desc = "Add line to opencode", expr = true })
vim.keymap.set("n", "<S-C-u>", function() require("opencode").command("session.half.page.up") end, { desc = "Scroll opencode up" })
vim.keymap.set("n", "<S-C-d>", function() require("opencode").command("session.half.page.down") end, { desc = "Scroll opencode down" })
@ -406,7 +441,7 @@ in
extraConfig = ''
colorscheme ${cfg.colorscheme}
'';
extraLuaConfig = ''
initLua = ''
${builtins.readFile ./settings.lua}
${builtins.replaceStrings [ "@HOSTNAME@" ] [ cfg.hostname ] (builtins.readFile ./plugins.lua)}
require("custom")

View file

@ -42,6 +42,7 @@ local servers = {
zls = {
enable_build_on_save = true,
semantic_tokens = "partial",
global_cache_path = vim.fn.getcwd(0, 0) .. "/.cache/zls",
},
},
},
@ -52,7 +53,11 @@ local servers = {
html = { filetypes = { "html", "blade" } },
htmx = { filetypes = { "html", "blade" } },
gopls = {},
ols = {},
ols = {
enable_semantic_tokens = true,
enable_auto_import = true,
checker_args = "-vet",
},
wgsl_analyzer = {},
}
for server, config in pairs(servers) do
@ -77,12 +82,12 @@ local leap = require("leap")
leap.opts.preview = function(ch0, ch1, ch2)
return not (ch1:match("%s") or (ch0:match("%a") and ch1:match("%a") and ch2:match("%a")))
end
leap.opts.equivalence_classes = {
" \t\r\n",
"([{",
")]}",
"'\"`",
}
-- leap.opts.equivalence_classes = {
-- " \t\r\n",
-- "([{",
-- ")]}",
-- "'\"`",
-- }
vim.api.nvim_set_hl(0, "LeapBackdrop", { link = "Comment" })
do

View file

@ -107,9 +107,6 @@ vim.keymap.set({ "n", "t" }, "<C-H>", function()
end, { desc = "Go to previous tab" })
vim.keymap.set({ "n", "t" }, "<C-Space>", "<C-w>p", { desc = "Go to previous pane" })
vim.keymap.set("n", "<localleader>v", "<cmd>vsplit<cr>", { desc = "split (vertical line)" })
vim.keymap.set("n", "<leader>h", "<cmd>split<cr>", { desc = "split (horizontal line)" })
vim.keymap.set("n", "<localleader><localleader>", "<cmd>w<cr>", { desc = "save buffer" })
vim.diagnostic.config({

View file

@ -2,6 +2,9 @@
{
home-manager.users.root =
{ config, ... }:
let
HOME = "/root";
in
{
imports = [ ./nvim ];
home.username = "root";
@ -12,13 +15,6 @@
home.file."/.ssh/desktop.pub".text =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILquARrJ3Vyh5z6aeVoiYrkLpgiMts+V/JzFEvs3Cnth root@icefox.sh";
xdg.userDirs = {
enable = false;
extraConfig = {
XDG_CACHE_HOME = "${config.home.homeDirectory}/.cache";
};
};
programs = {
ssh = {
enable = true;
@ -48,7 +44,7 @@
name = "root";
};
gpg.format = "ssh";
user.signingkey = "${config.home.homeDirectory}/.ssh/desktop.pub";
user.signingkey = "${HOME}/.ssh/desktop.pub";
commit.gpgsign = true;
tag.gpgsign = true;
core = {

View file

@ -7,13 +7,13 @@
lib,
...
}:
let
HOME = "/home/user";
in
{
home.username = "user";
home.homeDirectory = "/home/user";
home.homeDirectory = HOME;
home.stateVersion = "25.11";
home.sessionVariables = {
HOME = "/home/user";
};
imports = [
./nvim
@ -21,15 +21,15 @@
];
sops.defaultSopsFile = ../secrets/home.yaml;
sops.age.keyFile = "/.persist/${config.home.homeDirectory}/.config/sops/age/keys.txt";
sops.age.keyFile = "/.persist/${HOME}/.config/sops/age/keys.txt";
sops.secrets."user/ssh/desktop" = {
path = "${config.home.homeDirectory}/.ssh/desktop";
path = "${HOME}/.ssh/desktop";
mode = "0600";
};
home.file."/.ssh/desktop.pub".text =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILABd/iSJ4gn/ystDqNxLJTG0n0z5VIC9YXlmdUfOhHf desktop@icefox.sh";
sops.secrets."user/ssh/legacy_ed25519" = {
path = "${config.home.homeDirectory}/.ssh/legacy_ed25519";
path = "${HOME}/.ssh/legacy_ed25519";
mode = "0600";
};
home.file."/.ssh/legacy_ed25519.pub".text =
@ -51,18 +51,21 @@
# "Xft.rgba" = "rgb";
# };
# systemd.user.services.xrdb-configure = {
# Unit = {
# Description = "Load Xresources";
# };
# Intall = {
# WantedBy = [ "graphical-session.target" ];
# };
# Service = {
# ExecStart = "${pkgs.xrdb}/bin/xrdb -merge ${config.home.homeDirectory}/.Xresources";
# Type = "oneshot";
# };
# };
systemd.user.services.waypipe-socket = {
Unit = {
Description = "start waypipe client";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.waypipe}/bin/waypipe --socket /tmp/waypipe.sock client";
ExecStartPost = "${pkgs.acl}/bin/setfacl -m u:agent:rw /tmp/waypipe.sock";
RuntimeDirectory = "waypipe";
Type = "simple";
Restart = "on-failure";
};
};
sops.secrets."user/gpg/legacy_fnzr" = { };
home.activation.importGpgKey = config.lib.dag.entryAfter [ "writeBoundary" ] ''
if [[ -f "${config.sops.secrets."user/gpg/legacy_fnzr".path}" ]]; then
@ -92,225 +95,6 @@
};
};
# xdg.configFile."opencode/opencode.json".text = builtins.toJSON {
# "$schema" = "https://opencode.ai/config.json";
# plugin = [ "opencode-antigravity-auth@latest" ];
# provider = {
# google = {
# models = {
# antigravity-gemini-3-pro = {
# name = "Gemini 3 Pro (Antigravity)";
# limit = {
# context = 1048576;
# output = 65535;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# variants = {
# low = {
# thinkingLevel = "low";
# };
# high = {
# thinkingLevel = "high";
# };
# };
# };
# antigravity-gemini-3-flash = {
# name = "Gemini 3 Flash (Antigravity)";
# limit = {
# context = 1048576;
# output = 65536;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# variants = {
# minimal = {
# thinkingLevel = "minimal";
# };
# low = {
# thinkingLevel = "low";
# };
# medium = {
# thinkingLevel = "medium";
# };
# high = {
# thinkingLevel = "high";
# };
# };
# };
# antigravity-claude-sonnet-4-5 = {
# name = "Claude Sonnet 4.5 (Antigravity)";
# limit = {
# context = 200000;
# output = 64000;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# };
# antigravity-claude-sonnet-4-5-thinking = {
# name = "Claude Sonnet 4.5 Thinking (Antigravity)";
# limit = {
# context = 200000;
# output = 64000;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# variants = {
# low = {
# thinkingConfig = {
# thinkingBudget = 8192;
# };
# };
# max = {
# thinkingConfig = {
# thinkingBudget = 32768;
# };
# };
# };
# };
# antigravity-claude-opus-4-5-thinking = {
# name = "Claude Opus 4.5 Thinking (Antigravity)";
# limit = {
# context = 200000;
# output = 64000;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# variants = {
# low = {
# thinkingConfig = {
# thinkingBudget = 8192;
# };
# };
# max = {
# thinkingConfig = {
# thinkingBudget = 32768;
# };
# };
# };
# };
# antigravity-claude-opus-4-6-thinking = {
# name = "Claude Opus 4.6 Thinking (Antigravity)";
# limit = {
# context = 200000;
# output = 64000;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# variants = {
# low = {
# thinkingConfig = {
# thinkingBudget = 8192;
# };
# };
# max = {
# thinkingConfig = {
# thinkingBudget = 32768;
# };
# };
# };
# };
# "gemini-2.5-flash" = {
# name = "Gemini 2.5 Flash (Gemini CLI)";
# limit = {
# context = 1048576;
# output = 65536;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# };
# "gemini-2.5-pro" = {
# name = "Gemini 2.5 Pro (Gemini CLI)";
# limit = {
# context = 1048576;
# output = 65536;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# };
# gemini-3-flash-preview = {
# name = "Gemini 3 Flash Preview (Gemini CLI)";
# limit = {
# context = 1048576;
# output = 65536;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# };
# gemini-3-pro-preview = {
# name = "Gemini 3 Pro Preview (Gemini CLI)";
# limit = {
# context = 1048576;
# output = 65535;
# };
# modalities = {
# input = [
# "text"
# "image"
# "pdf"
# ];
# output = [ "text" ];
# };
# };
# };
# };
# };
# };
xdg.desktopEntries = {
google-chrome = {
name = "Google Chrome";
@ -427,19 +211,20 @@
xdg.userDirs = {
enable = true;
createDirectories = true;
setSessionVariables = true;
download = "${config.home.homeDirectory}/downloads";
documents = "${config.home.homeDirectory}/documents";
desktop = "${config.home.homeDirectory}/desktop";
pictures = "${config.home.homeDirectory}/pictures";
music = "${config.home.homeDirectory}/music";
videos = "${config.home.homeDirectory}/videos";
templates = "${config.home.homeDirectory}";
publicShare = "${config.home.homeDirectory}";
download = "${HOME}/downloads";
documents = "${HOME}/documents";
desktop = "${HOME}/desktop";
pictures = "${HOME}/pictures";
music = "${HOME}/music";
videos = "${HOME}/videos";
templates = "${HOME}";
publicShare = "${HOME}";
extraConfig = {
SCREENSHOTS = "${config.home.homeDirectory}/pictures/screenshots";
XDG_CACHE_HOME = "${config.home.homeDirectory}/.cache";
SCREENSHOTS = "$HOME/pictures/screenshots";
XDG_CACHE_HOME = "$HOME/.cache";
};
};
@ -475,7 +260,7 @@
enable = true;
lfs.enable = true;
signing = {
key = "${config.home.homeDirectory}/.ssh/desktop.pub";
key = "${HOME}/.ssh/desktop.pub";
signByDefault = true;
};
includes = [
@ -485,6 +270,7 @@
user = {
name = "felipematos";
email = "5471818+fnzr@users.noreply.github.com";
signingkey = "${HOME}/.ssh/desktop.pub";
};
};
}
@ -493,7 +279,7 @@
user = {
email = "felipe@icefox.sh";
name = "icefox";
signingkey = "${config.home.homeDirectory}/.ssh/desktop.pub";
signingkey = "${HOME}/.ssh/desktop.pub";
};
gpg.format = "ssh";
commit.gpgsign = true;
@ -537,12 +323,20 @@
help = {
autocorrect = "prompt";
};
safe = {
directory = [
"/home/agent/*"
];
};
};
};
};
home.packages = with pkgs; [
xrdb
(writeShellScriptBin "agent" ''
machinectl shell agent@ ${waypipe}/bin/waypipe --socket /run/waypipe.sock server fish
'')
(writeShellApplication {
name = "tmux-sessionizer";
runtimeInputs = [
@ -551,20 +345,7 @@
];
text = builtins.readFile ./bin/tmux-sessionizer;
})
(writeShellScriptBin "opencode" ''
ssh -t user@192.168.77.2 "
cd $(pwd) 2>/dev/null || cd \$(mktemp -d)
opencode $*
"
'')
(writeShellScriptBin "claude" ''
ssh -t user@192.168.77.2 "
cd $(pwd) 2>/dev/null || cd \$(mktemp -d)
claude $*
"
'')
];
custom.tmux.enable = true;
custom.neovim = {
enable = true;