{ lib, buildNpmPackage, fetchurl, ripgrep, makeWrapper, jq, ... }: buildNpmPackage rec { pname = "cline"; version = "2.4.2"; src = fetchurl { url = "https://registry.npmjs.org/cline/-/cline-${version}.tgz"; hash = "sha256-2utOBC0vhoj5fR+cG+Vdo3N6+i/pNW1E4mESF/dZS/c="; }; sourceRoot = "package"; postPatch = '' cp ${./cline-package-lock.json} package-lock.json # Remove @vscode/ripgrep from package.json since it tries to download # a binary from GitHub during install, which fails in the nix sandbox. # We provide ripgrep from nixpkgs instead via PATH wrapping. # Also remove the man field since the man page is not included in the npm tarball. ${jq}/bin/jq 'del(.dependencies["@vscode/ripgrep"]) | del(.man)' package.json > package.json.tmp mv package.json.tmp package.json ''; npmDepsHash = "sha256-oHo60ghR7A4SUT0cLmIe7glPDYBK3twJ0F71RKVrxQc="; dontNpmBuild = true; # Skip post-install scripts to be safe npmFlags = ["--ignore-scripts"]; nativeBuildInputs = [makeWrapper jq]; # Provide ripgrep from nixpkgs since @vscode/ripgrep was removed postInstall = '' wrapProgram $out/bin/cline \ --prefix PATH : ${lib.makeBinPath [ripgrep]} ''; meta = with lib; { description = "Autonomous coding agent CLI - capable of creating/editing files, running commands, using the browser, and more"; homepage = "https://cline.bot"; license = licenses.asl20; mainProgram = "cline"; }; }