Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
90 lines
2.0 KiB
Nix
90 lines
2.0 KiB
Nix
{
|
|
lib,
|
|
buildNpmPackage,
|
|
fetchzip,
|
|
ripgrep,
|
|
makeWrapper,
|
|
testers,
|
|
}:
|
|
|
|
buildNpmPackage (finalAttrs: {
|
|
pname = "amp-cli";
|
|
version = "0.0.1759233723-gf92434";
|
|
|
|
src = fetchzip {
|
|
url = "https://registry.npmjs.org/@sourcegraph/amp/-/amp-${finalAttrs.version}.tgz";
|
|
hash = "sha256-r48Odw2PA9ei3WrCm+Q8eGXCY1TVzyrqJa9FLzW84vs=";
|
|
};
|
|
|
|
postPatch = ''
|
|
cp ${./package-lock.json} package-lock.json
|
|
|
|
# Create a minimal package.json with just the dependency we need (without devDependencies)
|
|
cat > package.json <<EOF
|
|
{
|
|
"name": "amp-cli",
|
|
"version": "0.0.0",
|
|
"license": "UNLICENSED",
|
|
"dependencies": {
|
|
"@sourcegraph/amp": "${finalAttrs.version}"
|
|
},
|
|
"bin": {
|
|
"amp": "./bin/amp-wrapper.js"
|
|
}
|
|
}
|
|
EOF
|
|
|
|
# Create wrapper bin directory
|
|
mkdir -p bin
|
|
|
|
# Create a wrapper script that will be installed by npm
|
|
cat > bin/amp-wrapper.js << EOF
|
|
#!/usr/bin/env node
|
|
import('@sourcegraph/amp/dist/main.js')
|
|
EOF
|
|
chmod +x bin/amp-wrapper.js
|
|
'';
|
|
|
|
npmDepsHash = "sha256-Al8JZ2g68ZvMTxDbZM9grKz7C217YJxnjWnO8o8ySnI=";
|
|
|
|
propagatedBuildInputs = [
|
|
ripgrep
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
];
|
|
|
|
npmFlags = [
|
|
"--no-audit"
|
|
"--no-fund"
|
|
"--ignore-scripts"
|
|
];
|
|
|
|
# Disable build and prune steps
|
|
dontNpmBuild = true;
|
|
|
|
postInstall = ''
|
|
wrapProgram $out/bin/amp \
|
|
--prefix PATH : ${lib.makeBinPath [ ripgrep ]}
|
|
'';
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
passthru.tests.version = testers.testVersion {
|
|
package = finalAttrs.finalPackage;
|
|
command = "HOME=$(mktemp -d) amp --version";
|
|
};
|
|
|
|
meta = {
|
|
description = "CLI for Amp, an agentic coding agent in research preview from Sourcegraph";
|
|
homepage = "https://ampcode.com/";
|
|
downloadPage = "https://www.npmjs.com/package/@sourcegraph/amp";
|
|
license = lib.licenses.unfree;
|
|
maintainers = with lib.maintainers; [
|
|
keegancsmith
|
|
burmudar
|
|
];
|
|
mainProgram = "amp";
|
|
};
|
|
})
|