Unverified Commit 614b9fff authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

github-copilot-cli: fix build by switching from buildNpmPackage to st… (#455605)

parents 8e19f0f9 c905d0aa
Loading
Loading
Loading
Loading
+0 −58
Original line number Diff line number Diff line
{
  "name": "@github/copilot",
  "version": "0.0.328",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "@github/copilot",
      "version": "0.0.328",
      "dependencies": {
        "keytar-forked-forked": "^7.10.2",
        "node-pty": "npm:@devm33/node-pty@^1.0.8"
      },
      "bin": {
        "copilot": "index.js"
      },
      "engines": {
        "node": ">=22"
      }
    },
    "node_modules/keytar-forked-forked": {
      "version": "7.10.3",
      "resolved": "https://registry.npmjs.org/keytar-forked-forked/-/keytar-forked-forked-7.10.3.tgz",
      "integrity": "sha512-ipErTUO1NPXmngYhnMrda0yOIOPSNbVJ2BRjk3kNozLx3UmGICnzCfEDemuLY6HgP+rV0c9F+Opt+89+Ydbw6w==",
      "hasInstallScript": true,
      "license": "MIT",
      "dependencies": {
        "node-addon-api": "^8.3.0"
      }
    },
    "node_modules/node-addon-api": {
      "version": "8.5.0",
      "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz",
      "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==",
      "license": "MIT",
      "engines": {
        "node": "^18 || ^20 || >= 21"
      }
    },
    "node_modules/node-pty": {
      "name": "@devm33/node-pty",
      "version": "1.0.9",
      "resolved": "https://registry.npmjs.org/@devm33/node-pty/-/node-pty-1.0.9.tgz",
      "integrity": "sha512-5yzbTTywkaFk1iRwte2aWEpyDfcpDjCofVD1BiOUQI+fsCvp/+RdJnB4jgnULrdlWOEWuBf+bg4/NZKVApPhoQ==",
      "hasInstallScript": true,
      "license": "MIT",
      "dependencies": {
        "node-addon-api": "^7.1.0"
      }
    },
    "node_modules/node-pty/node_modules/node-addon-api": {
      "version": "7.1.1",
      "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
      "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
      "license": "MIT"
    }
  }
}
+20 −7
Original line number Diff line number Diff line
{
  lib,
  buildNpmPackage,
  stdenv,
  fetchzip,
  nodejs,
  makeBinaryWrapper,
  versionCheckHook,
  nix-update-script,
}:

buildNpmPackage (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
  pname = "github-copilot-cli";
  version = "0.0.328";

@@ -14,15 +17,25 @@ buildNpmPackage (finalAttrs: {
    hash = "sha256-9oTaVjvwyS8KY8N5kUEiAs+l6vEd/BZ0AGJI0p9Jie0=";
  };

  npmDepsHash = "sha256-WK6t3IW4uF+MDu7Y5GRinbm8iDcYB8RhJ15GE9VBcjQ=";
  nativeBuildInputs = [ makeBinaryWrapper ];

  postPatch = ''
    cp ${./package-lock.json} package-lock.json
  installPhase = ''
    runHook preInstall

    mkdir -p $out/lib/node_modules/@github/copilot
    cp -r . $out/lib/node_modules/@github/copilot

    mkdir -p $out/bin
    makeBinaryWrapper ${nodejs}/bin/node $out/bin/copilot \
      --add-flags "$out/lib/node_modules/@github/copilot/index.js"

    runHook postInstall
  '';

  dontNpmBuild = true;
  nativeInstallCheckInputs = [ versionCheckHook ];
  doInstallCheck = true;

  passthru.updateScript = nix-update-script { extraArgs = [ "--generate-lockfile" ]; };
  passthru.updateScript = nix-update-script { };

  meta = {
    description = "GitHub Copilot CLI brings the power of Copilot coding agent directly to your terminal";