nixpkgs/pkgs/by-name/co/code2prompt/package.nix
2024-06-10 17:22:54 +02:00

48 lines
1.0 KiB
Nix

{
lib,
fetchFromGitHub,
rustPlatform,
pkg-config,
openssl,
stdenv,
darwin,
}:
rustPlatform.buildRustPackage rec {
pname = "code2prompt";
version = "1.1.0";
src = fetchFromGitHub {
owner = "mufeedvh";
repo = "code2prompt";
rev = "v${version}";
hash = "sha256-KZqh0Vq4Mn56PhUO1JUzVpNBAGOZqUAsj31Cj5K+Lyk=";
};
cargoLock = {
lockFile = ./Cargo.lock;
};
postPatch = ''
# src is missing Cargo.lock
ln -s ${./Cargo.lock} Cargo.lock
'';
nativeBuildInputs = [ pkg-config ];
buildInputs =
[ openssl ]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.AppKit
];
meta = {
description = "A CLI tool that converts your codebase into a single LLM prompt with a source tree, prompt templating, and token counting";
homepage = "https://github.com/mufeedvh/code2prompt";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ heisfer ];
mainProgram = "code2prompt";
};
}