7056685370
CI / check (push) Has been cancelled
Add guregodevo/memdoor, a Go coding/automation agent, built from source: - the binary embeds the React UI through web/embed.go (`//go:embed all:dist`), and upstream gitignores web/dist, so the bundle is built with buildNpmPackage and copied into web/dist before the Go build - CGO stays off: the SQLite driver is modernc.org/sqlite, so FTS5 needs no C flags and the binary is static - upstream's whole Go suite runs (buildGoModule would trim checks to subPackages, where cmd/cli has no tests); it needs git on PATH and separate scratch dirs for HOME and the Go temp root, because one test writes ~/.memdoor and ProjectRoot walks up looking for that marker Track the package in beads as nix-overlay-yxj.
109 lines
3.1 KiB
Nix
109 lines
3.1 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
buildNpmPackage,
|
|
fetchFromGitHub,
|
|
git,
|
|
}:
|
|
|
|
let
|
|
version = "1.769.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "guregodevo";
|
|
repo = "memdoor";
|
|
rev = "v${version}";
|
|
hash = "sha256-ksQEPBlU4y3Y+NhvicBHnqa6ZpQ9k0YlByTZcqWsjXY=";
|
|
};
|
|
|
|
# web/embed.go does `//go:embed all:dist`, so the binary ships the React UI.
|
|
# Upstream builds that bundle with `make web-build` (vite) and web/dist is
|
|
# gitignored, so the source archive carries none and the Go build fails
|
|
# without this step.
|
|
frontend = buildNpmPackage {
|
|
pname = "memdoor-web";
|
|
inherit version src;
|
|
sourceRoot = "source/web";
|
|
|
|
npmDepsHash = "sha256-NiIw1yXV1eamajcLOP+zEHt/yviihXjgv2aqdJs6ztc=";
|
|
makeCacheWritable = true;
|
|
|
|
# `npm run build` also runs the upstream prebuild hook, which copies
|
|
# docs/reference/*.md over the served copies in web/public/docs/.
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out
|
|
cp -r dist/* $out/
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
in
|
|
|
|
buildGoModule rec {
|
|
pname = "memdoor";
|
|
inherit version src;
|
|
|
|
vendorHash = "sha256-MuvQkzGBJXTj5JufNWZuQiHTOHpqX73XanV0OdLPWgY=";
|
|
|
|
# cmd/cli is the only shipped command; eval/editbench is a dev benchmark.
|
|
subPackages = [ "cmd/cli" ];
|
|
|
|
# The SQLite driver is modernc.org/sqlite (SQLite translated to Go), so the
|
|
# binary stays static and FTS5 needs no C flags: upstream's
|
|
# CGO_CFLAGS=-DSQLITE_ENABLE_FTS5 is left over from the mattn driver.
|
|
env.CGO_ENABLED = 0;
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X memdoor/cmd/cli/cmd.Version=v${version}"
|
|
"-X memdoor/cmd/cli/cmd.Commit=${src.rev}"
|
|
"-X memdoor/cmd/cli/cmd.BuildDate=1970-01-01T00:00:00Z"
|
|
];
|
|
|
|
preBuild = ''
|
|
mkdir -p web/dist
|
|
cp -r ${frontend}/* web/dist/
|
|
'';
|
|
|
|
# Upstream's whole suite. buildGoModule would trim checks to `subPackages`,
|
|
# and cmd/cli has no tests of its own. The suite needs git: tests run
|
|
# `git init`, and the skill loader only calls a skill eligible when a
|
|
# `requires:` binary is on PATH. HOME and the Go temp root get separate
|
|
# scratch dirs, because one test writes ~/.memdoor and ProjectRoot walks up
|
|
# from the temp dir looking for that marker.
|
|
doCheck = true;
|
|
nativeCheckInputs = [ git ];
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
mkdir -p "$TMPDIR/scratch/home" "$TMPDIR/scratch/tmp"
|
|
export TMPDIR="$TMPDIR/scratch/tmp"
|
|
export HOME="$TMPDIR/scratch/home"
|
|
go test ./...
|
|
runHook postCheck
|
|
'';
|
|
|
|
# `go install ./cmd/cli` names the binary after the directory.
|
|
postInstall = ''
|
|
mv $out/bin/cli $out/bin/memdoor
|
|
'';
|
|
|
|
passthru = {
|
|
category = "AI Coding Agents";
|
|
updateScript = [
|
|
"nix-update"
|
|
"--flake"
|
|
".#memdoor"
|
|
];
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Coding and automation agent in one CLI binary: local or over SSH, with YAML workflows and a decision model in front of the chat model";
|
|
homepage = "https://github.com/guregodevo/memdoor";
|
|
changelog = "https://github.com/guregodevo/memdoor/blob/v${version}/CHANGELOG.md";
|
|
license = licenses.asl20;
|
|
mainProgram = "memdoor";
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
};
|
|
}
|