diff --git a/pkgs-set/pkgs/gitnexus.nix b/pkgs-set/pkgs/gitnexus.nix new file mode 100644 --- /dev/null +++ b/pkgs-set/pkgs/gitnexus.nix @@ -0,0 +1,35 @@ +{ + lib, + buildNpmPackage, + fetchFromGitHub, + git, + python3, + ... +}: +buildNpmPackage rec { + pname = "gitnexus"; + version = "1.3.10"; + + src = fetchFromGitHub { + owner = "abhigyanpatwari"; + repo = "GitNexus"; + rev = "v${version}"; + hash = "sha256-GfY1PrAFgeDG5LYudK1jZ0Ovi50pyqLOvVYI6RPhN1c="; + }; + sourceRoot = "${src.name}/gitnexus"; + + npmDepsHash = "sha256-4niBbBr1/anaNdhZ+LEyZiZS6W60NYuHmbQMupI31uk="; + outputHash = ""; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + + nativeBuildInputs = [git python3]; + + meta = { + description = "graph-powered code intelligence engine — index any codebase, query via MCP or CLI"; + homepage = "https://github.com/abhigyanpatwari/GitNexus"; + license = lib.licenses.mit; + mainProgram = "gitnexus"; + platforms = lib.platforms.unix; + }; +} diff --git a/pkgs-set/pkgs/pi-coding-agent.nix b/pkgs-set/pkgs/pi-coding-agent.nix new file mode 100644 --- /dev/null +++ b/pkgs-set/pkgs/pi-coding-agent.nix @@ -0,0 +1,88 @@ +{ + lib, + buildNpmPackage, + fetchFromGitHub, + typescript-go, + nix-update-script, + versionCheckHook, + writableTmpDirAsHomeHook, + ... +}: +buildNpmPackage (finalAttrs: { + pname = "pi-coding-agent"; + version = "0.57.1"; + + src = fetchFromGitHub { + owner = "badlogic"; + repo = "pi-mono"; + tag = "v${finalAttrs.version}"; + hash = "sha256-mx4Mb3aKcjnsD6QOfN+dttL3HQtvaVkwpfqFiuIihlU="; + }; + + npmDepsHash = "sha256-pNNY10RizBmLdUIqh1s+8eH/UjyvY0gwk+uRDLAx0iY="; + + npmWorkspace = "packages/coding-agent"; + + # Skip native module rebuild for unneeded workspaces (e.g. canvas from web-ui) + npmRebuildFlags = [ "--ignore-scripts" ]; + + nativeBuildInputs = [ typescript-go ]; + + # Build workspace dependencies in order, then the coding-agent. + # We invoke tsgo directly for workspace deps to skip pi-ai's + # generate-models script which requires network access + # (models.generated.ts is committed to the repo). + buildPhase = '' + runHook preBuild + + tsgo -p packages/ai/tsconfig.build.json + tsgo -p packages/tui/tsconfig.build.json + tsgo -p packages/agent/tsconfig.build.json + npm run build --workspace=packages/coding-agent + + runHook postBuild + ''; + + # npm workspace symlinks in the output point into packages/ which + # doesn't exist there. Replace runtime deps with built content and + # delete the rest. + postInstall = '' + local nm="$out/lib/node_modules/pi-monorepo/node_modules" + + # Replace workspace deps needed at runtime with real copies + for ws in @mariozechner/pi-ai:packages/ai \ + @mariozechner/pi-agent-core:packages/agent \ + @mariozechner/pi-tui:packages/tui; do + IFS=: read -r pkg src <<< "$ws" + rm "$nm/$pkg" + cp -r "$src" "$nm/$pkg" + done + + # Delete remaining workspace symlinks + find "$nm" -type l -lname '*/packages/*' -delete + + # Clean up now-dangling .bin symlinks + find "$nm/.bin" -type l ! -exec test -e {} \; -delete + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ + writableTmpDirAsHomeHook + versionCheckHook + ]; + versionCheckKeepEnvironment = [ "HOME" ]; + versionCheckProgram = "${placeholder "out"}/bin/pi"; + versionCheckProgramArg = "--version"; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Coding agent CLI with read, bash, edit, write tools and session management"; + homepage = "https://shittycodingagent.ai/"; + downloadPage = "https://www.npmjs.com/package/@mariozechner/pi-coding-agent"; + changelog = "https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ munksgaard ]; + mainProgram = "pi"; + }; +}) \ No newline at end of file diff --git a/users/mayer/default.nix b/users/mayer/default.nix --- a/users/mayer/default.nix +++ b/users/mayer/default.nix @@ -160,12 +160,16 @@ bs-manager cemu tor-browser - # supersonic-wayland feishin - opencode + nodejs + gcc + gnumake + python3 ]) ++ [ terra.helium terra.antigravity + terra.pi-coding-agent + # terra.gitnexus # (terra.pds-upload.override { # secretsFile = config.age.secrets.atfileCfg.path; # }) diff --git a/users/modules/nushell/default.nix b/users/modules/nushell/default.nix --- a/users/modules/nushell/default.nix +++ b/users/modules/nushell/default.nix @@ -15,6 +15,12 @@ }; extraEnv = '' source-env ${./prompt.nu} + if (which node | length) > 0 { + use std/util "path add" + mkdir ~/.npm-global + npm config set prefix '~/.npm-global' + path add '~/.npm-global/bin' + } ''; extraConfig = '' source ${./aliases.nu}