Add pi-coding-agent package, simplify Go builds with unstable.buildGoModule
Some checks failed
CI / build-and-cache (push) Has been cancelled
CI / check (push) Has been cancelled

- Add pi-coding-agent package (v0.55.4) with multi-platform support
- Replace custom Go 1.25.6 override with nixpkgs-unstable buildGoModule
  for beads and perles builds
- Update flake inputs: beads, nixpkgs-unstable, perles
- Update vendor hashes for beads and perles
- Add pi-coding-agent to development role
This commit is contained in:
2026-03-04 11:32:50 -08:00
parent eb4700226f
commit 8fd702cad0
6 changed files with 97 additions and 38 deletions

18
flake.lock generated
View File

@@ -8,11 +8,11 @@
]
},
"locked": {
"lastModified": 1771401137,
"narHash": "sha256-RarPa2n2mTd3LhXM+cJbP9tXEUdDksqkNXVWPAQF0xw=",
"lastModified": 1772564781,
"narHash": "sha256-TQ5+ovYaNnpFl3WwT1oaj77R45BwiXnAGAIskeHhlGw=",
"owner": "steveyegge",
"repo": "beads",
"rev": "16af00d7576f8b4fd7bb59f54b344c8fbc6d7af4",
"rev": "cd033d5cce8362d067b994c53023b46fe2ae1f7d",
"type": "github"
},
"original": {
@@ -301,11 +301,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1769170682,
"narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=",
"lastModified": 1772542754,
"narHash": "sha256-WGV2hy+VIeQsYXpsLjdr4GvHv5eECMISX1zKLTedhdg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c5296fdd05cfa2c187990dd909864da9658df755",
"rev": "8c809a146a140c5c8806f13399592dbcb1bb5dc4",
"type": "github"
},
"original": {
@@ -318,11 +318,11 @@
"perles": {
"flake": false,
"locked": {
"lastModified": 1769460725,
"narHash": "sha256-zM2jw+emxe8+mNyR1ebMWkQiEx8uSmhoqqI0IxXLDgs=",
"lastModified": 1772555208,
"narHash": "sha256-b1hpa7Zp6Kb6j5wo2rpI16+yfmAAyHE450lEM+XXx3s=",
"owner": "zjrosen",
"repo": "perles",
"rev": "57b20413eea461452b59e13f5a4a367953b1f768",
"rev": "55793dd89fe9f788d9a72fa1a7cdb0cce17c9502",
"type": "github"
},
"original": {

View File

@@ -275,6 +275,7 @@
"qt-pinned-stremio" = pkgsQt.stremio;
# Flake input packages (beads, gastown) - these get version from input rev
"custom-beads" = pkgs.callPackage ./packages/beads {
inherit (pkgs.unstable) buildGoModule;
src = inputs.beads;
version = "0.52.0-${beadsRev}";
};

View File

@@ -8,23 +8,13 @@ let
# Build beads from flake input
beadsRev = builtins.substring 0 8 (globalInputs.beads.rev or "unknown");
# beads' dolt deps require Go >= 1.25.6 (GOTOOLCHAIN=auto can't download in sandbox)
go_1_25_6 = pkgs.go_1_25.overrideAttrs (old: rec {
version = "1.25.6";
src = pkgs.fetchurl {
url = "https://go.dev/dl/go${version}.src.tar.gz";
hash = "sha256-WMv3ceRNdt5vVtGeM7d9dFoeSJNAkih15GWFuXXCsFk=";
};
});
buildGoModule_1_25_6 = pkgs.buildGoModule.override { go = go_1_25_6; };
beadsPackage = buildGoModule_1_25_6 {
beadsPackage = pkgs.unstable.buildGoModule {
pname = "beads";
version = "0.52.0-${beadsRev}";
src = globalInputs.beads;
subPackages = [ "cmd/bd" ];
doCheck = false;
vendorHash = "sha256-M+JCxrKgUxCczYzMc2czLZ/JhdVulo7dH2YLTPrJVSc=";
vendorHash = "sha256-OL6QGf4xSMpEbmU+41pFdO0Rrs3H162T3pdiW9UfWR0=";
nativeBuildInputs = [ pkgs.git pkgs.pkg-config ];
buildInputs = [ pkgs.icu ];
meta = with lib; {
@@ -79,11 +69,11 @@ let
# Perles - TUI for beads issue tracking (no upstream flake.nix yet)
# Source is tracked via flake input for renovate updates
perlesRev = builtins.substring 0 8 (globalInputs.perles.rev or "unknown");
perlesPackage = pkgs.buildGoModule {
perlesPackage = pkgs.unstable.buildGoModule {
pname = "perles";
version = "unstable-${perlesRev}";
src = globalInputs.perles;
vendorHash = "sha256-JHERJDzbiqgjWXwRhXVjgDEiDQ3AUXRIONotfPF21B0=";
vendorHash = "sha256-A5LE9Cor/DRcJtVpiScSoqDYhJIKyaq0cbK+OGmr4XU=";
doCheck = false;
ldflags = [
@@ -147,6 +137,7 @@ in
# Custom packages
pkgs.custom.tea-rbw
pkgs.custom.pi-coding-agent
];
# Install Claude Code humanlayer command and agent plugins

View File

@@ -2,8 +2,6 @@
# Takes src as argument so it can be called from both overlay and flake packages
{ lib
, buildGoModule
, fetchurl
, go_1_25
, git
, pkg-config
, icu
@@ -11,23 +9,12 @@
, version ? "unknown"
}:
let
# beads' dolt deps require Go >= 1.25.6 (GOTOOLCHAIN=auto can't download in sandbox)
go_1_25_6 = go_1_25.overrideAttrs (old: rec {
version = "1.25.6";
src = fetchurl {
url = "https://go.dev/dl/go${version}.src.tar.gz";
hash = "sha256-WMv3ceRNdt5vVtGeM7d9dFoeSJNAkih15GWFuXXCsFk=";
};
});
buildGoModule_1_25_6 = buildGoModule.override { go = go_1_25_6; };
in
buildGoModule_1_25_6 {
buildGoModule {
pname = "beads";
inherit version src;
subPackages = [ "cmd/bd" ];
doCheck = false;
vendorHash = "sha256-M+JCxrKgUxCczYzMc2czLZ/JhdVulo7dH2YLTPrJVSc=";
vendorHash = "sha256-OL6QGf4xSMpEbmU+41pFdO0Rrs3H162T3pdiW9UfWR0=";
nativeBuildInputs = [ git pkg-config ];
buildInputs = [ icu ];
meta = with lib; {

View File

@@ -5,4 +5,5 @@
claude-code = pkgs.callPackage ./claude-code {};
mcrcon-rbw = pkgs.callPackage ./mcrcon-rbw {};
rclone-torbox-setup = pkgs.callPackage ./rclone-torbox-setup {};
pi-coding-agent = pkgs.callPackage ./pi-coding-agent {};
}

View File

@@ -0,0 +1,79 @@
{ lib
, stdenv
, fetchurl
, patchelf
, glibc
, makeWrapper
}:
let
version = "0.55.4";
srcs = {
aarch64-darwin = {
url = "https://github.com/badlogic/pi-mono/releases/download/v${version}/pi-darwin-arm64.tar.gz";
sha256 = "0vsav9frvnzskk6p6j60i7klrs3m8lphhyi4c39mv2mvhpm8fkl5";
};
x86_64-darwin = {
url = "https://github.com/badlogic/pi-mono/releases/download/v${version}/pi-darwin-x64.tar.gz";
sha256 = "1377rvhsiiww1bbpgv2v46fjm7iz2smmh8g2yhm28kbsq3gwvvr0";
};
x86_64-linux = {
url = "https://github.com/badlogic/pi-mono/releases/download/v${version}/pi-linux-x64.tar.gz";
sha256 = "1wnfwnkfq5ffz6wyqyhciv4lz06bpxims0hv0dlhz0f9vliyc1md";
};
aarch64-linux = {
url = "https://github.com/badlogic/pi-mono/releases/download/v${version}/pi-linux-arm64.tar.gz";
sha256 = "00fp37hgjl40kc59jfpv189i7np53ymm037hvds6k9y2sz818wjy";
};
};
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
in stdenv.mkDerivation {
pname = "pi-coding-agent";
inherit version;
src = fetchurl {
inherit (src) url sha256;
};
sourceRoot = "pi";
# Bun standalone binaries have JS code appended after the ELF sections
dontStrip = true;
dontPatchELF = true;
nativeBuildInputs = [ makeWrapper ]
++ lib.optionals stdenv.isLinux [ patchelf ];
installPhase = ''
runHook preInstall
# Install the full pi directory structure (binary + supporting files)
mkdir -p $out/lib/pi-coding-agent
cp -r . $out/lib/pi-coding-agent/
# Create bin wrapper that runs the binary from its lib directory
# (pi expects supporting files like themes and wasm relative to itself)
mkdir -p $out/bin
makeWrapper $out/lib/pi-coding-agent/pi $out/bin/pi
runHook postInstall
'';
# Manually patch the interpreter for bun standalone binaries on Linux
postFixup = lib.optionalString stdenv.isLinux ''
interpreter="${glibc}/lib/${if stdenv.hostPlatform.system == "aarch64-linux" then "ld-linux-aarch64.so.1" else "ld-linux-x86-64.so.2"}"
patchelf --set-interpreter "$interpreter" $out/lib/pi-coding-agent/pi
'';
meta = with lib; {
description = "Minimal terminal coding agent with extensible tools and session management";
homepage = "https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent";
license = licenses.mit;
maintainers = [ ];
platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" "aarch64-linux" ];
mainProgram = "pi";
};
}