1 { stdenv, lib, fetchFromGitHub, bun, makeBinaryWrapper }:
3 pin = lib.importJSON ./pin.json;
4 src = fetchFromGitHub {
10 node_modules = stdenv.mkDerivation {
11 pname = "helix-gpt-node_modules";
13 version = pin.version;
14 impureEnvVars = lib.fetchers.proxyImpureEnvVars
15 ++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ];
16 nativeBuildInputs = [ bun ];
19 bun install --no-progress --frozen-lockfile
22 mkdir -p $out/node_modules
24 cp -R ./node_modules $out
26 outputHash = pin."${stdenv.system}";
27 outputHashAlgo = "sha256";
28 outputHashMode = "recursive";
33 version = pin.version;
35 nativeBuildInputs = [ makeBinaryWrapper ];
45 ln -s ${node_modules}/node_modules $out
48 # bun is referenced naked in the package.json generated script
49 makeBinaryWrapper ${bun}/bin/bun $out/bin/helix-gpt \
50 --prefix PATH : ${lib.makeBinPath [ bun ]} \
51 --add-flags "run --prefer-offline --no-install --cwd $out ./src/app.ts"
57 homepage = "https://github.com/leona/helix-gpt";
58 changelog = "https://github.com/leona/helix-gpt/releases/tag/${src.rev}";
59 description = "Code completion LSP for Helix with support for Copilot + OpenAI";
60 mainProgram = "helix-gpt";
61 maintainers = with maintainers; [ happysalada ];
62 license = with licenses; [ mit ];
63 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];