diff --git a/.gitmodules b/.gitmodules index f740ede..a7bc1c6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ path = user/modules/bash/bash url = https://github.com/itme-brain/bash.git branch = master +[submodule "user/modules/pi/agent"] + path = user/modules/pi/agent + url = git@github.com:itme-brain/pi.git diff --git a/flake.lock b/flake.lock index aa265c3..a2673aa 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1773025010, - "narHash": "sha256-khlHllTsovXgT2GZ0WxT4+RvuMjNeR5OW0UYeEHPYQo=", + "lastModified": 1776613567, + "narHash": "sha256-gC9Cp5ibBmGD5awCA9z7xy6MW6iJufhazTYJOiGlCUI=", "owner": "nix-community", "repo": "disko", - "rev": "7b9f7f88ab3b339f8142dc246445abb3c370d3d3", + "rev": "32f4236bfc141ae930b5ba2fb604f561fed5219d", "type": "github" }, "original": { @@ -64,11 +64,11 @@ ] }, "locked": { - "lastModified": 1772985280, - "narHash": "sha256-FdrNykOoY9VStevU4zjSUdvsL9SzJTcXt4omdEDZDLk=", + "lastModified": 1775425411, + "narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=", "owner": "nix-community", "repo": "home-manager", - "rev": "8f736f007139d7f70752657dff6a401a585d6cbc", + "rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe", "type": "github" }, "original": { @@ -102,11 +102,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1773375660, - "narHash": "sha256-SEzUWw2Rf5Ki3bcM26nSKgbeoqi2uYy8IHVBqOKjX3w=", + "lastModified": 1777428379, + "narHash": "sha256-ypxFOeDz+CqADEQNL72haqGjvZQdBR5Vc7pyx2JDttI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e20095fe3c6cbb1ddcef89b26969a69a1570776", + "rev": "755f5aa91337890c432639c60b6064bb7fe67769", "type": "github" }, "original": { @@ -118,11 +118,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1776169885, - "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", + "lastModified": 1777268161, + "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", + "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76", "type": "github" }, "original": { @@ -134,11 +134,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1772963539, - "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "lastModified": 1777268161, + "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76", "type": "github" }, "original": { @@ -154,11 +154,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1773108757, - "narHash": "sha256-3BAoe2R6YA6Xjdsgx3urZ4Ns3LeTy0E/w5d1wPny910=", + "lastModified": 1777603930, + "narHash": "sha256-IkawcGZuNSlf7mkiGo6NgmZir248sd6mVvUj1kuPIMw=", "owner": "nix-community", "repo": "NUR", - "rev": "9f2c583704f122828e6f9893416ca3b007464ee6", + "rev": "e7e4dc38580b7ef29d36d4afd3ba808e4f7ef5d5", "type": "github" }, "original": { @@ -185,11 +185,11 @@ ] }, "locked": { - "lastModified": 1773550941, - "narHash": "sha256-wa/++bL2QeMUreNFBZEWluQfOYB0MnQIeGNMuaX9sfs=", + "lastModified": 1777338324, + "narHash": "sha256-bc+ZZCmOTNq86/svGnw0tVpH7vJaLYvGLLKFYP08Q8E=", "owner": "Mic92", "repo": "sops-nix", - "rev": "c469b6885f0dcd5c7c56bd935a0f08dbcd9e79e1", + "rev": "8eaee5c45428b28b8c47a83e4c09dccec5f279b5", "type": "github" }, "original": { diff --git a/system/machines/desktop/modules/home-manager/home.nix b/system/machines/desktop/modules/home-manager/home.nix index 41e88bc..9eea824 100644 --- a/system/machines/desktop/modules/home-manager/home.nix +++ b/system/machines/desktop/modules/home-manager/home.nix @@ -81,6 +81,8 @@ writing.enable = true; }; + pi.enable = true; + gui = { wm.hyprland.enable = true; browser.firefox.enable = true; diff --git a/system/machines/desktop/system.nix b/system/machines/desktop/system.nix index e981ab8..080e157 100644 --- a/system/machines/desktop/system.nix +++ b/system/machines/desktop/system.nix @@ -66,6 +66,13 @@ in }; }; + programs.nix-ld = { + enable = true; + libraries = with pkgs; [ + icu + ]; + }; + boot.loader = { systemd-boot = { enable = true; diff --git a/user/modules/bash/bash b/user/modules/bash/bash index 6667f36..f0fe41e 160000 --- a/user/modules/bash/bash +++ b/user/modules/bash/bash @@ -1 +1 @@ -Subproject commit 6667f36a9f83a88b33b691a5a9b701365267bbb3 +Subproject commit f0fe41e942dfedab23828131372a5545a6d5c4c6 diff --git a/user/modules/bash/default.nix b/user/modules/bash/default.nix index a1420a7..631890b 100644 --- a/user/modules/bash/default.nix +++ b/user/modules/bash/default.nix @@ -13,7 +13,7 @@ in }; home.file.".config/bash" = { - source = ./bash; + source = config.lib.file.mkOutOfStoreSymlink ./bash; recursive = true; }; diff --git a/user/modules/git/default.nix b/user/modules/git/default.nix index 26baea5..aa2ff58 100644 --- a/user/modules/git/default.nix +++ b/user/modules/git/default.nix @@ -8,9 +8,6 @@ in { options.modules.user.git = { enable = mkEnableOption "user.git"; }; config = mkIf cfg.enable { programs = { - git = { - enable = true; - }; gh = { enable = true; settings.git_protocol = "ssh"; @@ -19,10 +16,11 @@ in home = { packages = with pkgs; [ + git git-crypt ]; file.".config/git" = { - source = ./git; + source = config.lib.file.mkOutOfStoreSymlink ./git; recursive = true; }; }; diff --git a/user/modules/git/git b/user/modules/git/git index 8b16b70..7ea8c16 160000 --- a/user/modules/git/git +++ b/user/modules/git/git @@ -1 +1 @@ -Subproject commit 8b16b7047c3fa70945cca5a058408b57b2ef2e7f +Subproject commit 7ea8c164bc6ab3eaea2ff5743cfa2db62fd62397 diff --git a/user/modules/gui/alacritty/config/alacritty.nix b/user/modules/gui/alacritty/config/alacritty.nix index b396d7c..4df8cff 100644 --- a/user/modules/gui/alacritty/config/alacritty.nix +++ b/user/modules/gui/alacritty/config/alacritty.nix @@ -25,29 +25,29 @@ in colors = { primary = { background = "#000000"; - foreground = "#cdd6f4"; + foreground = "#dadada"; }; normal = { - black = "#1e2127"; - red = "#e06c75"; - green = "#98c379"; - yellow = "#d19a66"; - blue = "#61afef"; - magenta = "#c678dd"; - cyan = "#56b6c2"; - white = "#abb2bf"; + black = "#181818"; + red = "#ff6b6b"; + green = "#00b300"; + yellow = "#e8a060"; + blue = "#88ddcc"; + magenta = "#c490d0"; + cyan = "#b3f6c0"; + white = "#dadada"; }; bright = { - black = "#5c6370"; - red = "#e06c75"; - green = "#98c379"; - yellow = "#d19a66"; - blue = "#61afef"; - magenta = "#c678dd"; - cyan = "#56b6c2"; - white = "#ffffff"; + black = "#5a5a5a"; + red = "#ff6b6b"; + green = "#00b300"; + yellow = "#ffcc00"; + blue = "#88ddcc"; + magenta = "#c490d0"; + cyan = "#b3f6c0"; + white = "#ffffff"; }; }; diff --git a/user/modules/gui/utils/default.nix b/user/modules/gui/utils/default.nix index f162ad3..626a269 100644 --- a/user/modules/gui/utils/default.nix +++ b/user/modules/gui/utils/default.nix @@ -11,6 +11,7 @@ in home.packages = with pkgs; [ gimp libreoffice + signal-desktop ]; }; } diff --git a/user/modules/neovim/default.nix b/user/modules/neovim/default.nix index 9a90d08..2c81e51 100644 --- a/user/modules/neovim/default.nix +++ b/user/modules/neovim/default.nix @@ -12,11 +12,26 @@ in defaultEditor = true; vimAlias = true; vimdiffAlias = true; - extraPackages = import ./pkgs.nix { inherit pkgs; }; + extraWrapperArgs = [ + "--suffix" + "PATH" + ":" + "${config.home.homeDirectory}/.npm-global/bin" + ]; + extraPackages = with pkgs; [ + gcc + cargo + rustc + + fzf + fd + ripgrep + bat + ]; }; home.file.".config/nvim" = { - source = ./nvim; + source = config.lib.file.mkOutOfStoreSymlink ./nvim; recursive = true; }; }; diff --git a/user/modules/neovim/nvim b/user/modules/neovim/nvim index da6106c..376b9c5 160000 --- a/user/modules/neovim/nvim +++ b/user/modules/neovim/nvim @@ -1 +1 @@ -Subproject commit da6106c77470b336783951ff2bce795688e9663d +Subproject commit 376b9c5c16b9d8b121b73516219082e57b397bc9 diff --git a/user/modules/neovim/pkgs.nix b/user/modules/neovim/pkgs.nix deleted file mode 100644 index 04dcd86..0000000 --- a/user/modules/neovim/pkgs.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ pkgs, ... }: - -let - # Essential LSPs for config files (project-specific LSPs go in devShells) - lsp = with pkgs; [ - nixd - lua-language-server - marksman - taplo - ]; - - lsp' = with pkgs.nodePackages; [ - vscode-langservers-extracted # jsonls, html, cssls - bash-language-server - yaml-language-server - ]; - - extraPackages = with pkgs; [ - lazygit - gcc - ]; - -in - extraPackages ++ lsp ++ lsp' diff --git a/user/modules/pi/agent b/user/modules/pi/agent new file mode 160000 index 0000000..b0524fd --- /dev/null +++ b/user/modules/pi/agent @@ -0,0 +1 @@ +Subproject commit b0524fdd3056c7dd951b41f7da410dde37f91a67 diff --git a/user/modules/pi/default.nix b/user/modules/pi/default.nix new file mode 100644 index 0000000..aa3bf51 --- /dev/null +++ b/user/modules/pi/default.nix @@ -0,0 +1,82 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.user.pi; + npmGlobal = "${config.home.homeDirectory}/.npm-global"; + piVersion = "0.70.5"; + +in +{ options.modules.user.pi = { enable = mkEnableOption "user.pi"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ nodejs_20 ]; + + home.sessionVariables = { + LLAMACPP_BASE_URL = "https://ai.ramos.codes/v1"; + NPM_CONFIG_PREFIX = npmGlobal; + }; + + home.sessionPath = [ "${npmGlobal}/bin" ]; + + programs.bash.initExtra = '' + export LLAMACPP_API_KEY=$(cat /run/secrets/LLAMA_API_KEY) + ''; + + home.activation.installPiCodingAgent = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + PATH="${pkgs.nodejs_20}/bin:$PATH" + agentDir="${config.home.homeDirectory}/.pi/agent" + piPkgScope="${npmGlobal}/lib/node_modules/@mariozechner" + piPkgDir="${npmGlobal}/lib/node_modules/@mariozechner/pi-coding-agent" + piBin="${npmGlobal}/bin/pi" + run mkdir -p ${npmGlobal} + run mkdir -p "${npmGlobal}/bin" + run mkdir -p "$piPkgScope" + run mkdir -p "${config.home.homeDirectory}/.pi" + run mkdir -p "$agentDir" + if [ -e "$agentDir" ]; then + run chmod -R u+w "$agentDir" + run find "$agentDir" -mindepth 1 -maxdepth 1 -exec rm -rf {} + + fi + run cp -R ${./agent}/. "$agentDir"/ + run chmod -R u+w "$agentDir" + run rm -f "$piBin" + run rm -f "${npmGlobal}/bin"/.pi-* + run rm -rf "$piPkgDir" + run rm -rf "$piPkgScope"/.pi-coding-agent-* + if ! run ${pkgs.nodejs_20}/bin/npm install -g --prefix ${npmGlobal} @mariozechner/pi-coding-agent@${piVersion}; then + warnEcho "pi-coding-agent install failed (offline or registry error)" + fi + + if [ ! -f "$piPkgDir/package.json" ]; then + for candidate in "$piPkgScope"/.pi-coding-agent-*; do + if [ -f "$candidate/package.json" ]; then + run rm -rf "$piPkgDir" + run mv "$candidate" "$piPkgDir" + break + fi + done + fi + + if [ -f "$piPkgDir/dist/cli.js" ]; then + run ln -sfn ../lib/node_modules/@mariozechner/pi-coding-agent/dist/cli.js "$piBin" + run chmod +x "$piPkgDir/dist/cli.js" + else + warnEcho "pi-coding-agent install did not produce dist/cli.js" + fi + + for ext in "$agentDir"/extensions/*; do + if [ -f "$ext/package.json" ]; then + if [ -f "$ext/package-lock.json" ]; then + if ! run ${pkgs.nodejs_20}/bin/npm ci --prefix "$ext"; then + warnEcho "pi extension dependency install failed for $ext" + fi + else + if ! run ${pkgs.nodejs_20}/bin/npm install --prefix "$ext"; then + warnEcho "pi extension dependency install failed for $ext" + fi + fi + fi + done + ''; + }; +} diff --git a/user/modules/utils/dev/default.nix b/user/modules/utils/dev/default.nix index 991524b..c106cc2 100644 --- a/user/modules/utils/dev/default.nix +++ b/user/modules/utils/dev/default.nix @@ -9,7 +9,6 @@ in home.packages = with pkgs; [ unstable.claude-code unstable.codex - unstable.opencode bubblewrap diff --git a/user/modules/vim/default.nix b/user/modules/vim/default.nix index 68aed8a..05a1ce4 100644 --- a/user/modules/vim/default.nix +++ b/user/modules/vim/default.nix @@ -16,7 +16,7 @@ in vim ]; file.".vim" = { - source = ./vim; + source = config.lib.file.mkOutOfStoreSymlink ./vim; recursive = true; }; }; diff --git a/user/modules/vim/vim b/user/modules/vim/vim index 8c8a4e4..d5bdb39 160000 --- a/user/modules/vim/vim +++ b/user/modules/vim/vim @@ -1 +1 @@ -Subproject commit 8c8a4e4a7afd175be2eb97055bb01f43ee8b992d +Subproject commit d5bdb39d7e65e679b3052e5ec437f75e4ec8e594