2025-05-07 09:17:30 +03:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildNpmPackage,
|
|
|
|
fetchzip,
|
|
|
|
ripgrep,
|
|
|
|
makeWrapper,
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildNpmPackage rec {
|
|
|
|
pname = "amp-cli";
|
2025-05-27 13:27:40 +00:00
|
|
|
version = "0.0.1748347293-g7a57b5";
|
2025-05-07 09:17:30 +03:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://registry.npmjs.org/@sourcegraph/amp/-/amp-${version}.tgz";
|
2025-05-27 13:27:40 +00:00
|
|
|
hash = "sha256-15R7RojQgF9B5voQfsB0aLNIBR2M7qqLNpMa950pAKM=";
|
2025-05-07 09:17:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
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": "${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
|
|
|
|
require('@sourcegraph/amp/dist/amp.js')
|
|
|
|
EOF
|
|
|
|
chmod +x bin/amp-wrapper.js
|
|
|
|
'';
|
|
|
|
|
2025-05-27 13:27:40 +00:00
|
|
|
npmDepsHash = "sha256-4CSXRNCKgRunMZvFM2w6wrAcTb03iPjPprTm67fHZ9Q=";
|
2025-05-07 09:17:30 +03:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Amp is an AI coding agent, in research preview from Sourcegraph. This is the CLI for Amp.";
|
2025-05-22 10:20:34 +02:00
|
|
|
homepage = "https://ampcode.com/";
|
2025-05-07 09:17:30 +03:00
|
|
|
downloadPage = "https://www.npmjs.com/package/@sourcegraph/amp";
|
|
|
|
license = lib.licenses.unfree;
|
2025-05-14 11:11:51 +03:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
keegancsmith
|
|
|
|
owickstrom
|
2025-05-07 09:17:30 +03:00
|
|
|
];
|
|
|
|
mainProgram = "amp";
|
|
|
|
};
|
|
|
|
}
|