1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5}:
6
7buildGoModule (finalAttrs: {
8 pname = "codegrab";
9 version = "1.0.7";
10
11 src = fetchFromGitHub {
12 owner = "epilande";
13 repo = "codegrab";
14 tag = "v${finalAttrs.version}";
15 hash = "sha256-gKxvPcAZ8TnECAs3iMkFfZKdaq8vkLz/T9MUBWk4MfQ=";
16 leaveDotGit = true;
17 postFetch = ''
18 cd "$out"
19 git rev-parse --short HEAD > $out/COMMIT
20 find "$out" -name .git -print0 | xargs -0 rm -rf
21 '';
22 };
23
24 vendorHash = "sha256-u9pVOZOwK6xLdR4tlWN2eBoJZ2ziPEdJv78uCV0Suus=";
25
26 checkFlags = [
27 "-skip=TestParseSizeString"
28 ];
29
30 ldflags = [
31 "-s"
32 "-w"
33 "-X=github.com/epilande/codegrab/internal/utils.Version=${finalAttrs.version}"
34 ];
35
36 # ldflags based on metadata from git and source
37 preBuild = ''
38 ldflags+=" -X=github.com/epilande/codegrab/internal/utils.CommitSHA=$(cat COMMIT)"
39 '';
40
41 meta = {
42 description = "Interactive CLI tool for selecting and bundling code into a single, LLM-ready output file";
43 homepage = "https://github.com/epilande/codegrab";
44 changelog = "https://github.com/epilande/codegrab/releases/tag/${finalAttrs.src.tag}";
45 license = lib.licenses.mit;
46 maintainers = with lib.maintainers; [ taha-yassine ];
47 mainProgram = "grab";
48 };
49})